proxygen
folly::detail::FingerprintPolynomial< DEG > Class Template Reference

#include <FingerprintPolynomial.h>

Public Member Functions

constexpr FingerprintPolynomial ()
 
constexpr FingerprintPolynomial (const uint64_t(&vals)[size()])
 
constexpr uint64_t get (size_t i) const
 
constexpr void add (const FingerprintPolynomial< DEG > &other)
 
constexpr void mulX ()
 
constexpr void mulXmod (const FingerprintPolynomial< DEG > &p)
 
constexpr void mulXkmod (int k, const FingerprintPolynomial< DEG > &p)
 
constexpr void addXk (int k)
 
constexpr void setHigh8Bits (uint8_t val)
 

Static Public Member Functions

static constexpr int size ()
 

Private Attributes

uint64_t val_ [size()] = {}
 

Detailed Description

template<int DEG>
class folly::detail::FingerprintPolynomial< DEG >

Representation of a polynomial of degree DEG over GF(2) (that is, with binary coefficients).

Probably of no use outside of Fingerprint code; used by GenerateFingerprintTables and the unittest.

Definition at line 32 of file FingerprintPolynomial.h.

Constructor & Destructor Documentation

template<int DEG>
constexpr folly::detail::FingerprintPolynomial< DEG >::FingerprintPolynomial ( )
inline

Definition at line 38 of file FingerprintPolynomial.h.

38 {}
template<int DEG>
constexpr folly::detail::FingerprintPolynomial< DEG >::FingerprintPolynomial ( const uint64_t(&)  vals[size()])
inlineexplicit

Definition at line 40 of file FingerprintPolynomial.h.

40  {
41  for (int i = 0; i < size(); i++) {
42  val_[i] = vals[i];
43  }
44  }

Member Function Documentation

template<int DEG>
constexpr void folly::detail::FingerprintPolynomial< DEG >::add ( const FingerprintPolynomial< DEG > &  other)
inline

Definition at line 50 of file FingerprintPolynomial.h.

Referenced by folly::detail::FingerprintPolynomial< BITS-1 >::mulXmod().

50  {
51  for (int i = 0; i < size(); i++) {
52  val_[i] ^= other.val_[i];
53  }
54  }
template<int DEG>
constexpr void folly::detail::FingerprintPolynomial< DEG >::addXk ( int  k)
inline

Definition at line 107 of file FingerprintPolynomial.h.

Referenced by folly::detail::SlowFingerprint< BITS >::SlowFingerprint(), and folly::detail::SlowFingerprint< BITS >::updateBit().

107  {
108  int word_offset = (DEG - k) / 64;
109  int bit_offset = 63 - (DEG - k) % 64;
110  val_[word_offset] ^= (1ULL << bit_offset);
111  }
KeyT k
template<int DEG>
constexpr uint64_t folly::detail::FingerprintPolynomial< DEG >::get ( size_t  i) const
inline

Definition at line 46 of file FingerprintPolynomial.h.

Referenced by folly::detail::SlowFingerprint< BITS >::write().

46  {
47  return val_[i];
48  }
template<int DEG>
constexpr void folly::detail::FingerprintPolynomial< DEG >::mulX ( )
inline

Definition at line 57 of file FingerprintPolynomial.h.

Referenced by folly::detail::FingerprintPolynomial< BITS-1 >::mulXmod().

57  {
58  uint64_t b = 0;
59  for (int i = size() - 1; i >= 0; i--) {
60  uint64_t nb = val_[i] >> 63;
61  val_[i] = (val_[i] << 1) | b;
62  b = nb;
63  }
64  }
char b
template<int DEG>
constexpr void folly::detail::FingerprintPolynomial< DEG >::mulXkmod ( int  k,
const FingerprintPolynomial< DEG > &  p 
)
inline

Definition at line 100 of file FingerprintPolynomial.h.

100  {
101  for (int i = 0; i < k; i++) {
102  mulXmod(p);
103  }
104  }
constexpr void mulXmod(const FingerprintPolynomial< DEG > &p)
KeyT k
template<int DEG>
constexpr void folly::detail::FingerprintPolynomial< DEG >::mulXmod ( const FingerprintPolynomial< DEG > &  p)
inline

Definition at line 90 of file FingerprintPolynomial.h.

Referenced by folly::detail::FingerprintPolynomial< BITS-1 >::mulXkmod(), and folly::detail::SlowFingerprint< BITS >::updateBit().

90  {
91  bool needXOR = (val_[0] & (1ULL << 63));
92  val_[0] &= ~(1ULL << 63);
93  mulX();
94  if (needXOR) {
95  add(p);
96  }
97  }
constexpr void add(const FingerprintPolynomial< DEG > &other)
template<int DEG>
constexpr void folly::detail::FingerprintPolynomial< DEG >::setHigh8Bits ( uint8_t  val)
inline

Definition at line 116 of file FingerprintPolynomial.h.

116  {
117  val_[0] = ((uint64_t)val) << (64 - 8);
118  for (int i = 1; i < size(); i++) {
119  val_[i] = 0;
120  }
121  }
double val
Definition: String.cpp:273

Member Data Documentation


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