Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:35

0001 /*
0002    xxHash - Extremely Fast Hash algorithm
0003    Header File
0004    Copyright (C) 2012-2016, Yann Collet.
0005 
0006    BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
0007 
0008    Redistribution and use in source and binary forms, with or without
0009    modification, are permitted provided that the following conditions are
0010    met:
0011 
0012        * Redistributions of source code must retain the above copyright
0013    notice, this list of conditions and the following disclaimer.
0014        * Redistributions in binary form must reproduce the above
0015    copyright notice, this list of conditions and the following disclaimer
0016    in the documentation and/or other materials provided with the
0017    distribution.
0018 
0019    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0020    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0021    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0022    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0023    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0024    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0025    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0026    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0027    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0028    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0029    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0030 
0031    You can contact the author at :
0032    - xxHash source repository : https://github.com/Cyan4973/xxHash
0033 */
0034 
0035 /* based on revision d2df04efcbef7d7f6886d345861e5dfda4edacc1 Removed
0036  * everything but a simple interface for computing XXh64. */
0037 
0038 #ifndef LLVM_SUPPORT_XXHASH_H
0039 #define LLVM_SUPPORT_XXHASH_H
0040 
0041 #include "llvm/ADT/ArrayRef.h"
0042 #include "llvm/ADT/StringRef.h"
0043 
0044 namespace llvm {
0045 
0046 uint64_t xxHash64(llvm::StringRef Data);
0047 uint64_t xxHash64(llvm::ArrayRef<uint8_t> Data);
0048 
0049 uint64_t xxh3_64bits(ArrayRef<uint8_t> data);
0050 inline uint64_t xxh3_64bits(StringRef data) {
0051   return xxh3_64bits(ArrayRef(data.bytes_begin(), data.size()));
0052 }
0053 
0054 /*-**********************************************************************
0055  *  XXH3 128-bit variant
0056  ************************************************************************/
0057 
0058 /*!
0059  * @brief The return value from 128-bit hashes.
0060  *
0061  * Stored in little endian order, although the fields themselves are in native
0062  * endianness.
0063  */
0064 struct XXH128_hash_t {
0065   uint64_t low64;  /*!< `value & 0xFFFFFFFFFFFFFFFF` */
0066   uint64_t high64; /*!< `value >> 64` */
0067 
0068   /// Convenience equality check operator.
0069   bool operator==(const XXH128_hash_t rhs) const {
0070     return low64 == rhs.low64 && high64 == rhs.high64;
0071   }
0072 };
0073 
0074 /// XXH3's 128-bit variant.
0075 XXH128_hash_t xxh3_128bits(ArrayRef<uint8_t> data);
0076 
0077 } // namespace llvm
0078 
0079 #endif