X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2FSpookyHashV2.h;h=9cc3474a68a0f7d42a18d528371831ac419406f6;hp=f32d8fe5dc9e7c450ecb399698924e6572a74696;hb=5cef863eee8a03e1b6b137fb283d6fe703f35d2d;hpb=275ca94d04e44f28cfa411668eb1c1dd8db90b80 diff --git a/folly/SpookyHashV2.h b/folly/SpookyHashV2.h index f32d8fe5..9cc3474a 100644 --- a/folly/SpookyHashV2.h +++ b/folly/SpookyHashV2.h @@ -1,5 +1,5 @@ /* - * Copyright 2015 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. @@ -43,8 +43,7 @@ // slower than MD5. // -#ifndef FOLLY_SPOOKYHASHV2_H_ -#define FOLLY_SPOOKYHASHV2_H_ +#pragma once #include #include @@ -114,8 +113,8 @@ public: // all the pieces concatenated into one message. // void Final( - uint64_t *hash1, // out only: first 64 bits of hash value. - uint64_t *hash2); // out only: second 64 bits of hash value. + uint64_t *hash1, // out only: first 64 bits of hash value. + uint64_t *hash2) const; // out only: second 64 bits of hash value. // // left rotate a 64-bit value by k bytes @@ -282,13 +281,13 @@ private: uint64_t *hash2); // in/out: in the seed, out the hash value // number of uint64_t's in internal state - static const size_t sc_numVars = 12; + static constexpr size_t sc_numVars = 12; // size of the internal state - static const size_t sc_blockSize = sc_numVars*8; + static constexpr size_t sc_blockSize = sc_numVars*8; // size of buffer of unhashed data, in bytes - static const size_t sc_bufSize = 2*sc_blockSize; + static constexpr size_t sc_bufSize = 2*sc_blockSize; // // sc_const: a constant which: @@ -297,7 +296,7 @@ private: // * is a not-very-regular mix of 1's and 0's // * does not need any other special mathematical properties // - static const uint64_t sc_const = 0xdeadbeefdeadbeefLL; + static constexpr uint64_t sc_const = 0xdeadbeefdeadbeefULL; uint64_t m_data[2*sc_numVars]; // unhashed data, for partial messages uint64_t m_state[sc_numVars]; // internal state of the hash @@ -307,5 +306,3 @@ private: } // namespace hash } // namespace folly - -#endif