proxygen
folly::detail::float_hasher< F > Struct Template Reference

#include <Hash.h>

Public Types

using folly_is_avalanching = std::true_type
 

Public Member Functions

size_t operator() (F const &f) const noexcept
 

Detailed Description

template<typename F>
struct folly::detail::float_hasher< F >

Definition at line 339 of file Hash.h.

Member Typedef Documentation

template<typename F>
using folly::detail::float_hasher< F >::folly_is_avalanching = std::true_type

Definition at line 340 of file Hash.h.

Member Function Documentation

template<typename F>
size_t folly::detail::float_hasher< F >::operator() ( F const &  f) const
inlinenoexcept

Definition at line 342 of file Hash.h.

342  {
343  static_assert(sizeof(F) <= 8, "Input type is too wide");
344 
345  if (f == F{}) { // Ensure 0 and -0 get the same hash.
346  return 0;
347  }
348 
349  uint64_t u64 = 0;
350  memcpy(&u64, &f, sizeof(F));
351  return static_cast<size_t>(hash::twang_mix64(u64));
352  }
auto f
uint64_t twang_mix64(uint64_t key) noexcept
Definition: Hash.h:49

The documentation for this struct was generated from the following file: