zstdlib 0.7.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +20 -0
  3. data/README.md +7 -1
  4. data/Rakefile +38 -8
  5. data/ext/{zstdlib → zstdlib_c}/extconf.rb +11 -6
  6. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.2/zstdlib.c +2 -2
  7. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.3/zstdlib.c +2 -2
  8. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.4/zstdlib.c +2 -2
  9. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.5/zstdlib.c +2 -2
  10. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.6/zstdlib.c +2 -2
  11. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.7/zstdlib.c +2 -2
  12. data/ext/zstdlib_c/ruby/zlib-3.0/zstdlib.c +4994 -0
  13. data/ext/zstdlib_c/ruby/zlib-3.1/zstdlib.c +5076 -0
  14. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/adler32.c +0 -0
  15. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/compress.c +0 -0
  16. data/ext/zstdlib_c/zlib-1.2.12/crc32.c +1116 -0
  17. data/ext/zstdlib_c/zlib-1.2.12/crc32.h +9446 -0
  18. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/deflate.c +78 -30
  19. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/deflate.h +12 -15
  20. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/gzclose.c +0 -0
  21. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/gzguts.h +3 -2
  22. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/gzlib.c +5 -3
  23. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/gzread.c +5 -7
  24. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/gzwrite.c +25 -13
  25. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/infback.c +2 -1
  26. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/inffast.c +14 -14
  27. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/inffast.h +0 -0
  28. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/inffixed.h +0 -0
  29. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/inflate.c +39 -8
  30. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/inflate.h +3 -2
  31. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/inftrees.c +3 -3
  32. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/inftrees.h +0 -0
  33. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/trees.c +27 -48
  34. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/trees.h +0 -0
  35. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/uncompr.c +0 -0
  36. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/zconf.h +0 -0
  37. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/zlib.h +123 -100
  38. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/zutil.c +2 -2
  39. data/ext/{zstdlib/zlib-1.2.11 → zstdlib_c/zlib-1.2.12}/zutil.h +12 -9
  40. data/ext/{zstdlib → zstdlib_c}/zlib.mk +0 -0
  41. data/ext/{zstdlib → zstdlib_c}/zlibwrapper/zlibwrapper.c +1 -5
  42. data/ext/{zstdlib → zstdlib_c}/zlibwrapper.mk +0 -0
  43. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/bitstream.h +46 -22
  44. data/ext/zstdlib_c/zstd-1.5.2/lib/common/compiler.h +335 -0
  45. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/cpu.h +1 -3
  46. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/debug.c +1 -1
  47. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/debug.h +12 -19
  48. data/ext/zstdlib_c/zstd-1.5.2/lib/common/entropy_common.c +368 -0
  49. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/error_private.c +2 -1
  50. data/ext/zstdlib_c/zstd-1.5.2/lib/common/error_private.h +159 -0
  51. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/fse.h +41 -12
  52. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/fse_decompress.c +139 -22
  53. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/huf.h +47 -23
  54. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/mem.h +87 -98
  55. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/pool.c +34 -23
  56. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/pool.h +4 -4
  57. data/ext/zstdlib_c/zstd-1.5.2/lib/common/portability_macros.h +137 -0
  58. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/threading.c +6 -5
  59. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/threading.h +0 -0
  60. data/ext/zstdlib_c/zstd-1.5.2/lib/common/xxhash.c +24 -0
  61. data/ext/zstdlib_c/zstd-1.5.2/lib/common/xxhash.h +5686 -0
  62. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/zstd_common.c +10 -10
  63. data/ext/zstdlib_c/zstd-1.5.2/lib/common/zstd_deps.h +111 -0
  64. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/common/zstd_internal.h +191 -145
  65. data/ext/zstdlib_c/zstd-1.5.2/lib/common/zstd_trace.h +163 -0
  66. data/ext/zstdlib_c/zstd-1.5.2/lib/compress/clevels.h +134 -0
  67. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/fse_compress.c +89 -46
  68. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/hist.c +27 -29
  69. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/hist.h +2 -2
  70. data/ext/zstdlib_c/zstd-1.5.2/lib/compress/huf_compress.c +1370 -0
  71. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress.c +2917 -868
  72. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_internal.h +458 -125
  73. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_literals.c +12 -11
  74. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_literals.h +4 -2
  75. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_sequences.c +41 -18
  76. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_sequences.h +1 -1
  77. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_superblock.c +26 -298
  78. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_superblock.h +1 -1
  79. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_cwksp.h +234 -83
  80. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_double_fast.c +313 -138
  81. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_double_fast.h +1 -1
  82. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_fast.c +329 -150
  83. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_fast.h +1 -1
  84. data/ext/zstdlib_c/zstd-1.5.2/lib/compress/zstd_lazy.c +2104 -0
  85. data/ext/zstdlib_c/zstd-1.5.2/lib/compress/zstd_lazy.h +125 -0
  86. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_ldm.c +321 -216
  87. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_ldm.h +9 -2
  88. data/ext/zstdlib_c/zstd-1.5.2/lib/compress/zstd_ldm_geartab.h +106 -0
  89. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_opt.c +412 -166
  90. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_opt.h +1 -1
  91. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/compress/zstdmt_compress.c +169 -453
  92. data/ext/zstdlib_c/zstd-1.5.2/lib/compress/zstdmt_compress.h +113 -0
  93. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/decompress/huf_decompress.c +1044 -403
  94. data/ext/zstdlib_c/zstd-1.5.2/lib/decompress/huf_decompress_amd64.S +585 -0
  95. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_ddict.c +9 -9
  96. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_ddict.h +2 -2
  97. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress.c +450 -105
  98. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress_block.c +913 -273
  99. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress_block.h +14 -5
  100. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress_internal.h +59 -12
  101. data/ext/zstdlib_c/zstd-1.5.2/lib/zdict.h +452 -0
  102. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/lib/zstd.h +699 -214
  103. data/ext/{zstdlib/zstd-1.4.5/lib/common → zstdlib_c/zstd-1.5.2/lib}/zstd_errors.h +2 -1
  104. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzclose.c +0 -0
  105. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzcompatibility.h +1 -1
  106. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzguts.h +0 -0
  107. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzlib.c +0 -0
  108. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzread.c +0 -0
  109. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzwrite.c +0 -0
  110. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/zstd_zlibwrapper.c +133 -44
  111. data/ext/{zstdlib/zstd-1.4.5 → zstdlib_c/zstd-1.5.2}/zlibWrapper/zstd_zlibwrapper.h +1 -1
  112. data/ext/zstdlib_c/zstd.mk +15 -0
  113. data/lib/zstdlib.rb +2 -2
  114. metadata +118 -109
  115. data/ext/zstdlib/zlib-1.2.11/crc32.c +0 -442
  116. data/ext/zstdlib/zlib-1.2.11/crc32.h +0 -441
  117. data/ext/zstdlib/zstd-1.4.5/lib/common/compiler.h +0 -175
  118. data/ext/zstdlib/zstd-1.4.5/lib/common/entropy_common.c +0 -216
  119. data/ext/zstdlib/zstd-1.4.5/lib/common/error_private.h +0 -80
  120. data/ext/zstdlib/zstd-1.4.5/lib/common/xxhash.c +0 -864
  121. data/ext/zstdlib/zstd-1.4.5/lib/common/xxhash.h +0 -285
  122. data/ext/zstdlib/zstd-1.4.5/lib/compress/huf_compress.c +0 -798
  123. data/ext/zstdlib/zstd-1.4.5/lib/compress/zstd_lazy.c +0 -1138
  124. data/ext/zstdlib/zstd-1.4.5/lib/compress/zstd_lazy.h +0 -67
  125. data/ext/zstdlib/zstd-1.4.5/lib/compress/zstdmt_compress.h +0 -192
  126. data/ext/zstdlib/zstd.mk +0 -14
@@ -1,285 +0,0 @@
1
- /*
2
- * xxHash - Extremely Fast Hash algorithm
3
- * Header File
4
- * Copyright (c) 2012-2020, Yann Collet, Facebook, Inc.
5
- *
6
- * You can contact the author at :
7
- * - xxHash source repository : https://github.com/Cyan4973/xxHash
8
- *
9
- * This source code is licensed under both the BSD-style license (found in the
10
- * LICENSE file in the root directory of this source tree) and the GPLv2 (found
11
- * in the COPYING file in the root directory of this source tree).
12
- * You may select, at your option, one of the above-listed licenses.
13
- */
14
-
15
- /* Notice extracted from xxHash homepage :
16
-
17
- xxHash is an extremely fast Hash algorithm, running at RAM speed limits.
18
- It also successfully passes all tests from the SMHasher suite.
19
-
20
- Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz)
21
-
22
- Name Speed Q.Score Author
23
- xxHash 5.4 GB/s 10
24
- CrapWow 3.2 GB/s 2 Andrew
25
- MumurHash 3a 2.7 GB/s 10 Austin Appleby
26
- SpookyHash 2.0 GB/s 10 Bob Jenkins
27
- SBox 1.4 GB/s 9 Bret Mulvey
28
- Lookup3 1.2 GB/s 9 Bob Jenkins
29
- SuperFastHash 1.2 GB/s 1 Paul Hsieh
30
- CityHash64 1.05 GB/s 10 Pike & Alakuijala
31
- FNV 0.55 GB/s 5 Fowler, Noll, Vo
32
- CRC32 0.43 GB/s 9
33
- MD5-32 0.33 GB/s 10 Ronald L. Rivest
34
- SHA1-32 0.28 GB/s 10
35
-
36
- Q.Score is a measure of quality of the hash function.
37
- It depends on successfully passing SMHasher test set.
38
- 10 is a perfect score.
39
-
40
- A 64-bits version, named XXH64, is available since r35.
41
- It offers much better speed, but for 64-bits applications only.
42
- Name Speed on 64 bits Speed on 32 bits
43
- XXH64 13.8 GB/s 1.9 GB/s
44
- XXH32 6.8 GB/s 6.0 GB/s
45
- */
46
-
47
- #if defined (__cplusplus)
48
- extern "C" {
49
- #endif
50
-
51
- #ifndef XXHASH_H_5627135585666179
52
- #define XXHASH_H_5627135585666179 1
53
-
54
-
55
- /* ****************************
56
- * Definitions
57
- ******************************/
58
- #include <stddef.h> /* size_t */
59
- typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
60
-
61
-
62
- /* ****************************
63
- * API modifier
64
- ******************************/
65
- /** XXH_PRIVATE_API
66
- * This is useful if you want to include xxhash functions in `static` mode
67
- * in order to inline them, and remove their symbol from the public list.
68
- * Methodology :
69
- * #define XXH_PRIVATE_API
70
- * #include "xxhash.h"
71
- * `xxhash.c` is automatically included.
72
- * It's not useful to compile and link it as a separate module anymore.
73
- */
74
- #ifdef XXH_PRIVATE_API
75
- # ifndef XXH_STATIC_LINKING_ONLY
76
- # define XXH_STATIC_LINKING_ONLY
77
- # endif
78
- # if defined(__GNUC__)
79
- # define XXH_PUBLIC_API static __inline __attribute__((unused))
80
- # elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
81
- # define XXH_PUBLIC_API static inline
82
- # elif defined(_MSC_VER)
83
- # define XXH_PUBLIC_API static __inline
84
- # else
85
- # define XXH_PUBLIC_API static /* this version may generate warnings for unused static functions; disable the relevant warning */
86
- # endif
87
- #else
88
- # define XXH_PUBLIC_API /* do nothing */
89
- #endif /* XXH_PRIVATE_API */
90
-
91
- /*!XXH_NAMESPACE, aka Namespace Emulation :
92
-
93
- If you want to include _and expose_ xxHash functions from within your own library,
94
- but also want to avoid symbol collisions with another library which also includes xxHash,
95
-
96
- you can use XXH_NAMESPACE, to automatically prefix any public symbol from xxhash library
97
- with the value of XXH_NAMESPACE (so avoid to keep it NULL and avoid numeric values).
98
-
99
- Note that no change is required within the calling program as long as it includes `xxhash.h` :
100
- regular symbol name will be automatically translated by this header.
101
- */
102
- #ifdef XXH_NAMESPACE
103
- # define XXH_CAT(A,B) A##B
104
- # define XXH_NAME2(A,B) XXH_CAT(A,B)
105
- # define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
106
- # define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64)
107
- # define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber)
108
- # define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState)
109
- # define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState)
110
- # define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState)
111
- # define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState)
112
- # define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
113
- # define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
114
- # define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
115
- # define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
116
- # define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
117
- # define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
118
- # define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState)
119
- # define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState)
120
- # define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash)
121
- # define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash)
122
- # define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical)
123
- # define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical)
124
- #endif
125
-
126
-
127
- /* *************************************
128
- * Version
129
- ***************************************/
130
- #define XXH_VERSION_MAJOR 0
131
- #define XXH_VERSION_MINOR 6
132
- #define XXH_VERSION_RELEASE 2
133
- #define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE)
134
- XXH_PUBLIC_API unsigned XXH_versionNumber (void);
135
-
136
-
137
- /* ****************************
138
- * Simple Hash Functions
139
- ******************************/
140
- typedef unsigned int XXH32_hash_t;
141
- typedef unsigned long long XXH64_hash_t;
142
-
143
- XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, unsigned int seed);
144
- XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed);
145
-
146
- /*!
147
- XXH32() :
148
- Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input".
149
- The memory between input & input+length must be valid (allocated and read-accessible).
150
- "seed" can be used to alter the result predictably.
151
- Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s
152
- XXH64() :
153
- Calculate the 64-bits hash of sequence of length "len" stored at memory address "input".
154
- "seed" can be used to alter the result predictably.
155
- This function runs 2x faster on 64-bits systems, but slower on 32-bits systems (see benchmark).
156
- */
157
-
158
-
159
- /* ****************************
160
- * Streaming Hash Functions
161
- ******************************/
162
- typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */
163
- typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */
164
-
165
- /*! State allocation, compatible with dynamic libraries */
166
-
167
- XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void);
168
- XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr);
169
-
170
- XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void);
171
- XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr);
172
-
173
-
174
- /* hash streaming */
175
-
176
- XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned int seed);
177
- XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length);
178
- XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr);
179
-
180
- XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed);
181
- XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length);
182
- XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr);
183
-
184
- /*
185
- These functions generate the xxHash of an input provided in multiple segments.
186
- Note that, for small input, they are slower than single-call functions, due to state management.
187
- For small input, prefer `XXH32()` and `XXH64()` .
188
-
189
- XXH state must first be allocated, using XXH*_createState() .
190
-
191
- Start a new hash by initializing state with a seed, using XXH*_reset().
192
-
193
- Then, feed the hash state by calling XXH*_update() as many times as necessary.
194
- Obviously, input must be allocated and read accessible.
195
- The function returns an error code, with 0 meaning OK, and any other value meaning there is an error.
196
-
197
- Finally, a hash value can be produced anytime, by using XXH*_digest().
198
- This function returns the nn-bits hash as an int or long long.
199
-
200
- It's still possible to continue inserting input into the hash state after a digest,
201
- and generate some new hashes later on, by calling again XXH*_digest().
202
-
203
- When done, free XXH state space if it was allocated dynamically.
204
- */
205
-
206
-
207
- /* **************************
208
- * Utils
209
- ****************************/
210
- #if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* ! C99 */
211
- # define restrict /* disable restrict */
212
- #endif
213
-
214
- XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* restrict dst_state, const XXH32_state_t* restrict src_state);
215
- XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* restrict dst_state, const XXH64_state_t* restrict src_state);
216
-
217
-
218
- /* **************************
219
- * Canonical representation
220
- ****************************/
221
- /* Default result type for XXH functions are primitive unsigned 32 and 64 bits.
222
- * The canonical representation uses human-readable write convention, aka big-endian (large digits first).
223
- * These functions allow transformation of hash result into and from its canonical format.
224
- * This way, hash values can be written into a file / memory, and remain comparable on different systems and programs.
225
- */
226
- typedef struct { unsigned char digest[4]; } XXH32_canonical_t;
227
- typedef struct { unsigned char digest[8]; } XXH64_canonical_t;
228
-
229
- XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash);
230
- XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash);
231
-
232
- XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src);
233
- XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src);
234
-
235
- #endif /* XXHASH_H_5627135585666179 */
236
-
237
-
238
-
239
- /* ================================================================================================
240
- This section contains definitions which are not guaranteed to remain stable.
241
- They may change in future versions, becoming incompatible with a different version of the library.
242
- They shall only be used with static linking.
243
- Never use these definitions in association with dynamic linking !
244
- =================================================================================================== */
245
- #if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXH_STATIC_H_3543687687345)
246
- #define XXH_STATIC_H_3543687687345
247
-
248
- /* These definitions are only meant to allow allocation of XXH state
249
- statically, on stack, or in a struct for example.
250
- Do not use members directly. */
251
-
252
- struct XXH32_state_s {
253
- unsigned total_len_32;
254
- unsigned large_len;
255
- unsigned v1;
256
- unsigned v2;
257
- unsigned v3;
258
- unsigned v4;
259
- unsigned mem32[4]; /* buffer defined as U32 for alignment */
260
- unsigned memsize;
261
- unsigned reserved; /* never read nor write, will be removed in a future version */
262
- }; /* typedef'd to XXH32_state_t */
263
-
264
- struct XXH64_state_s {
265
- unsigned long long total_len;
266
- unsigned long long v1;
267
- unsigned long long v2;
268
- unsigned long long v3;
269
- unsigned long long v4;
270
- unsigned long long mem64[4]; /* buffer defined as U64 for alignment */
271
- unsigned memsize;
272
- unsigned reserved[2]; /* never read nor write, will be removed in a future version */
273
- }; /* typedef'd to XXH64_state_t */
274
-
275
-
276
- # ifdef XXH_PRIVATE_API
277
- # include "xxhash.c" /* include xxhash functions as `static`, for inlining */
278
- # endif
279
-
280
- #endif /* XXH_STATIC_LINKING_ONLY && XXH_STATIC_H_3543687687345 */
281
-
282
-
283
- #if defined (__cplusplus)
284
- }
285
- #endif