/*
- * Copyright 2012 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#ifndef FOLLY_BUILD_FINGERPRINTPOLYNOMIAL_H_
-#define FOLLY_BUILD_FINGERPRINTPOLYNOMIAL_H_
+#pragma once
#include <cstdint>
// Multiply by X. The actual degree must be < DEG.
void mulX() {
- CHECK_EQ(0, val_[0] & (1UL<<63));
+ CHECK_EQ(0u, val_[0] & (1ULL << 63));
uint64_t b = 0;
for (int i = size()-1; i >= 0; i--) {
uint64_t nb = val_[i] >> 63;
// the binary representation of A, left shift by 1,
// XOR p if a_(k-1) == 1
void mulXmod(const FingerprintPolynomial<DEG>& p) {
- bool needXOR = (val_[0] & (1UL<<63));
- val_[0] &= ~(1UL<<63);
+ bool needXOR = (val_[0] & (1ULL<<63));
+ val_[0] &= ~(1ULL<<63);
mulX();
if (needXOR) {
add(p);
DCHECK_LE(k, DEG);
int word_offset = (DEG - k) / 64;
int bit_offset = 63 - (DEG - k) % 64;
- val_[word_offset] ^= (1UL << bit_offset);
+ val_[word_offset] ^= (1ULL << bit_offset);
}
// Set the highest 8 bits to val.
}
}
- static int size() {
+ static constexpr int size() {
return 1 + DEG/64;
}
private:
uint64_t val_[1 + DEG/64];
};
-} // namespace detail
-} // namespace folly
-
-#endif /* FOLLY_BUILD_FINGERPRINTPOLYNOMIAL_H_ */
-
+} // namespace detail
+} // namespace folly