contrib/python-zstandard/zstd/common/xxhash.h
changeset 37495 b1fb341d8a61
parent 30434 2e484bdea8c4
equal deleted inserted replaced
37494:1ce7a55b09d1 37495:b1fb341d8a61
    62 Name     Speed on 64 bits    Speed on 32 bits
    62 Name     Speed on 64 bits    Speed on 32 bits
    63 XXH64       13.8 GB/s            1.9 GB/s
    63 XXH64       13.8 GB/s            1.9 GB/s
    64 XXH32        6.8 GB/s            6.0 GB/s
    64 XXH32        6.8 GB/s            6.0 GB/s
    65 */
    65 */
    66 
    66 
    67 #ifndef XXHASH_H_5627135585666179
       
    68 #define XXHASH_H_5627135585666179 1
       
    69 
       
    70 #if defined (__cplusplus)
    67 #if defined (__cplusplus)
    71 extern "C" {
    68 extern "C" {
    72 #endif
    69 #endif
    73 
    70 
    74 #ifndef XXH_NAMESPACE
    71 #ifndef XXHASH_H_5627135585666179
    75 #  define XXH_NAMESPACE ZSTD_  /* Zstandard specific */
    72 #define XXHASH_H_5627135585666179 1
    76 #endif
       
    77 
    73 
    78 
    74 
    79 /* ****************************
    75 /* ****************************
    80 *  Definitions
    76 *  Definitions
    81 ******************************/
    77 ******************************/
   240 
   236 
   241 
   237 
   242 /* **************************
   238 /* **************************
   243 *  Canonical representation
   239 *  Canonical representation
   244 ****************************/
   240 ****************************/
   245 typedef struct { unsigned char digest[4]; } XXH32_canonical_t;
       
   246 typedef struct { unsigned char digest[8]; } XXH64_canonical_t;
       
   247 
       
   248 XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash);
       
   249 XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash);
       
   250 
       
   251 XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src);
       
   252 XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src);
       
   253 
       
   254 /* Default result type for XXH functions are primitive unsigned 32 and 64 bits.
   241 /* Default result type for XXH functions are primitive unsigned 32 and 64 bits.
   255 *  The canonical representation uses human-readable write convention, aka big-endian (large digits first).
   242 *  The canonical representation uses human-readable write convention, aka big-endian (large digits first).
   256 *  These functions allow transformation of hash result into and from its canonical format.
   243 *  These functions allow transformation of hash result into and from its canonical format.
   257 *  This way, hash values can be written into a file / memory, and remain comparable on different systems and programs.
   244 *  This way, hash values can be written into a file / memory, and remain comparable on different systems and programs.
   258 */
   245 */
   259 
   246 typedef struct { unsigned char digest[4]; } XXH32_canonical_t;
   260 
   247 typedef struct { unsigned char digest[8]; } XXH64_canonical_t;
   261 #ifdef XXH_STATIC_LINKING_ONLY
   248 
       
   249 XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash);
       
   250 XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash);
       
   251 
       
   252 XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src);
       
   253 XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src);
       
   254 
       
   255 #endif /* XXHASH_H_5627135585666179 */
       
   256 
       
   257 
   262 
   258 
   263 /* ================================================================================================
   259 /* ================================================================================================
   264    This section contains definitions which are not guaranteed to remain stable.
   260    This section contains definitions which are not guaranteed to remain stable.
   265    They may change in future versions, becoming incompatible with a different version of the library.
   261    They may change in future versions, becoming incompatible with a different version of the library.
   266    They shall only be used with static linking.
   262    They shall only be used with static linking.
   267    Never use these definitions in association with dynamic linking !
   263    Never use these definitions in association with dynamic linking !
   268 =================================================================================================== */
   264 =================================================================================================== */
       
   265 #if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXH_STATIC_H_3543687687345)
       
   266 #define XXH_STATIC_H_3543687687345
   269 
   267 
   270 /* These definitions are only meant to allow allocation of XXH state
   268 /* These definitions are only meant to allow allocation of XXH state
   271    statically, on stack, or in a struct for example.
   269    statically, on stack, or in a struct for example.
   272    Do not use members directly. */
   270    Do not use members directly. */
   273 
   271 
   297 
   295 
   298 #  ifdef XXH_PRIVATE_API
   296 #  ifdef XXH_PRIVATE_API
   299 #    include "xxhash.c"   /* include xxhash functions as `static`, for inlining */
   297 #    include "xxhash.c"   /* include xxhash functions as `static`, for inlining */
   300 #  endif
   298 #  endif
   301 
   299 
   302 #endif /* XXH_STATIC_LINKING_ONLY */
   300 #endif /* XXH_STATIC_LINKING_ONLY && XXH_STATIC_H_3543687687345 */
   303 
   301 
   304 
   302 
   305 #if defined (__cplusplus)
   303 #if defined (__cplusplus)
   306 }
   304 }
   307 #endif
   305 #endif
   308 
       
   309 #endif /* XXHASH_H_5627135585666179 */