zstdlib 0.13.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +6 -0
  3. data/CHANGES.md +107 -0
  4. data/Gemfile +3 -0
  5. data/README.md +107 -0
  6. data/Rakefile +59 -0
  7. data/ext/zstdlib_c/extconf.rb +59 -0
  8. data/ext/zstdlib_c/ruby/zlib-2.2/zstdlib.c +4675 -0
  9. data/ext/zstdlib_c/ruby/zlib-2.3/zstdlib.c +4702 -0
  10. data/ext/zstdlib_c/ruby/zlib-2.4/zstdlib.c +4859 -0
  11. data/ext/zstdlib_c/ruby/zlib-2.5/zstdlib.c +4864 -0
  12. data/ext/zstdlib_c/ruby/zlib-2.6/zstdlib.c +4906 -0
  13. data/ext/zstdlib_c/ruby/zlib-2.7/zstdlib.c +4895 -0
  14. data/ext/zstdlib_c/ruby/zlib-3.0/zstdlib.c +4994 -0
  15. data/ext/zstdlib_c/ruby/zlib-3.1/zstdlib.c +5076 -0
  16. data/ext/zstdlib_c/ruby/zlib-3.2/zstdlib.c +5090 -0
  17. data/ext/zstdlib_c/ruby/zlib-3.3/zstdlib.c +5090 -0
  18. data/ext/zstdlib_c/zlib-1.3.1/adler32.c +164 -0
  19. data/ext/zstdlib_c/zlib-1.3.1/compress.c +75 -0
  20. data/ext/zstdlib_c/zlib-1.3.1/crc32.c +1049 -0
  21. data/ext/zstdlib_c/zlib-1.3.1/crc32.h +9446 -0
  22. data/ext/zstdlib_c/zlib-1.3.1/deflate.c +2139 -0
  23. data/ext/zstdlib_c/zlib-1.3.1/deflate.h +377 -0
  24. data/ext/zstdlib_c/zlib-1.3.1/gzclose.c +23 -0
  25. data/ext/zstdlib_c/zlib-1.3.1/gzguts.h +214 -0
  26. data/ext/zstdlib_c/zlib-1.3.1/gzlib.c +582 -0
  27. data/ext/zstdlib_c/zlib-1.3.1/gzread.c +602 -0
  28. data/ext/zstdlib_c/zlib-1.3.1/gzwrite.c +631 -0
  29. data/ext/zstdlib_c/zlib-1.3.1/infback.c +628 -0
  30. data/ext/zstdlib_c/zlib-1.3.1/inffast.c +320 -0
  31. data/ext/zstdlib_c/zlib-1.3.1/inffast.h +11 -0
  32. data/ext/zstdlib_c/zlib-1.3.1/inffixed.h +94 -0
  33. data/ext/zstdlib_c/zlib-1.3.1/inflate.c +1526 -0
  34. data/ext/zstdlib_c/zlib-1.3.1/inflate.h +126 -0
  35. data/ext/zstdlib_c/zlib-1.3.1/inftrees.c +299 -0
  36. data/ext/zstdlib_c/zlib-1.3.1/inftrees.h +62 -0
  37. data/ext/zstdlib_c/zlib-1.3.1/trees.c +1117 -0
  38. data/ext/zstdlib_c/zlib-1.3.1/trees.h +128 -0
  39. data/ext/zstdlib_c/zlib-1.3.1/uncompr.c +85 -0
  40. data/ext/zstdlib_c/zlib-1.3.1/zconf.h +543 -0
  41. data/ext/zstdlib_c/zlib-1.3.1/zlib.h +1938 -0
  42. data/ext/zstdlib_c/zlib-1.3.1/zutil.c +299 -0
  43. data/ext/zstdlib_c/zlib-1.3.1/zutil.h +254 -0
  44. data/ext/zstdlib_c/zlib.mk +14 -0
  45. data/ext/zstdlib_c/zlibwrapper/zlibwrapper.c +10 -0
  46. data/ext/zstdlib_c/zlibwrapper.mk +14 -0
  47. data/ext/zstdlib_c/zstd-1.5.6/lib/common/allocations.h +55 -0
  48. data/ext/zstdlib_c/zstd-1.5.6/lib/common/bits.h +200 -0
  49. data/ext/zstdlib_c/zstd-1.5.6/lib/common/bitstream.h +457 -0
  50. data/ext/zstdlib_c/zstd-1.5.6/lib/common/compiler.h +450 -0
  51. data/ext/zstdlib_c/zstd-1.5.6/lib/common/cpu.h +249 -0
  52. data/ext/zstdlib_c/zstd-1.5.6/lib/common/debug.c +30 -0
  53. data/ext/zstdlib_c/zstd-1.5.6/lib/common/debug.h +116 -0
  54. data/ext/zstdlib_c/zstd-1.5.6/lib/common/entropy_common.c +340 -0
  55. data/ext/zstdlib_c/zstd-1.5.6/lib/common/error_private.c +63 -0
  56. data/ext/zstdlib_c/zstd-1.5.6/lib/common/error_private.h +168 -0
  57. data/ext/zstdlib_c/zstd-1.5.6/lib/common/fse.h +640 -0
  58. data/ext/zstdlib_c/zstd-1.5.6/lib/common/fse_decompress.c +313 -0
  59. data/ext/zstdlib_c/zstd-1.5.6/lib/common/huf.h +286 -0
  60. data/ext/zstdlib_c/zstd-1.5.6/lib/common/mem.h +426 -0
  61. data/ext/zstdlib_c/zstd-1.5.6/lib/common/pool.c +371 -0
  62. data/ext/zstdlib_c/zstd-1.5.6/lib/common/pool.h +90 -0
  63. data/ext/zstdlib_c/zstd-1.5.6/lib/common/portability_macros.h +158 -0
  64. data/ext/zstdlib_c/zstd-1.5.6/lib/common/threading.c +182 -0
  65. data/ext/zstdlib_c/zstd-1.5.6/lib/common/threading.h +150 -0
  66. data/ext/zstdlib_c/zstd-1.5.6/lib/common/xxhash.c +18 -0
  67. data/ext/zstdlib_c/zstd-1.5.6/lib/common/xxhash.h +7020 -0
  68. data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_common.c +48 -0
  69. data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_deps.h +111 -0
  70. data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_internal.h +392 -0
  71. data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_trace.h +163 -0
  72. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/clevels.h +134 -0
  73. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/fse_compress.c +625 -0
  74. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/hist.c +181 -0
  75. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/hist.h +75 -0
  76. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/huf_compress.c +1464 -0
  77. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress.c +7153 -0
  78. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_internal.h +1534 -0
  79. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_literals.c +235 -0
  80. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_literals.h +39 -0
  81. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_sequences.c +442 -0
  82. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_sequences.h +54 -0
  83. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_superblock.c +688 -0
  84. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_superblock.h +32 -0
  85. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_cwksp.h +748 -0
  86. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_double_fast.c +770 -0
  87. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_double_fast.h +50 -0
  88. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_fast.c +968 -0
  89. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_fast.h +38 -0
  90. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_lazy.c +2199 -0
  91. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_lazy.h +202 -0
  92. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm.c +730 -0
  93. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm.h +117 -0
  94. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm_geartab.h +106 -0
  95. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_opt.c +1576 -0
  96. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_opt.h +80 -0
  97. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstdmt_compress.c +1882 -0
  98. data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstdmt_compress.h +113 -0
  99. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/huf_decompress.c +1944 -0
  100. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/huf_decompress_amd64.S +595 -0
  101. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_ddict.c +244 -0
  102. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_ddict.h +44 -0
  103. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress.c +2407 -0
  104. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_block.c +2215 -0
  105. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_block.h +73 -0
  106. data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_internal.h +240 -0
  107. data/ext/zstdlib_c/zstd-1.5.6/lib/zdict.h +474 -0
  108. data/ext/zstdlib_c/zstd-1.5.6/lib/zstd.h +3089 -0
  109. data/ext/zstdlib_c/zstd-1.5.6/lib/zstd_errors.h +114 -0
  110. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzclose.c +26 -0
  111. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzcompatibility.h +68 -0
  112. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzguts.h +229 -0
  113. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzlib.c +587 -0
  114. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzread.c +637 -0
  115. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzwrite.c +631 -0
  116. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/zstd_zlibwrapper.c +1200 -0
  117. data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/zstd_zlibwrapper.h +91 -0
  118. data/ext/zstdlib_c/zstd.mk +15 -0
  119. data/lib/2.4/zstdlib_c.so +0 -0
  120. data/lib/2.5/zstdlib_c.so +0 -0
  121. data/lib/2.6/zstdlib_c.so +0 -0
  122. data/lib/2.7/zstdlib_c.so +0 -0
  123. data/lib/3.0/zstdlib_c.so +0 -0
  124. data/lib/3.1/zstdlib_c.so +0 -0
  125. data/lib/3.2/zstdlib_c.so +0 -0
  126. data/lib/3.3/zstdlib_c.so +0 -0
  127. data/lib/zstdlib.rb +6 -0
  128. data/test/zstdlib_test.rb +21 -0
  129. metadata +243 -0
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Copyright (c) 2016 Tino Reichardt
3
+ * All rights reserved.
4
+ *
5
+ * You can contact the author at:
6
+ * - zstdmt source repository: https://github.com/mcmilk/zstdmt
7
+ *
8
+ * This source code is licensed under both the BSD-style license (found in the
9
+ * LICENSE file in the root directory of this source tree) and the GPLv2 (found
10
+ * in the COPYING file in the root directory of this source tree).
11
+ * You may select, at your option, one of the above-listed licenses.
12
+ */
13
+
14
+ /**
15
+ * This file will hold wrapper for systems, which do not support pthreads
16
+ */
17
+
18
+ #include "threading.h"
19
+
20
+ /* create fake symbol to avoid empty translation unit warning */
21
+ int g_ZSTD_threading_useless_symbol;
22
+
23
+ #if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
24
+
25
+ /**
26
+ * Windows minimalist Pthread Wrapper
27
+ */
28
+
29
+
30
+ /* === Dependencies === */
31
+ #include <process.h>
32
+ #include <errno.h>
33
+
34
+
35
+ /* === Implementation === */
36
+
37
+ typedef struct {
38
+ void* (*start_routine)(void*);
39
+ void* arg;
40
+ int initialized;
41
+ ZSTD_pthread_cond_t initialized_cond;
42
+ ZSTD_pthread_mutex_t initialized_mutex;
43
+ } ZSTD_thread_params_t;
44
+
45
+ static unsigned __stdcall worker(void *arg)
46
+ {
47
+ void* (*start_routine)(void*);
48
+ void* thread_arg;
49
+
50
+ /* Initialized thread_arg and start_routine and signal main thread that we don't need it
51
+ * to wait any longer.
52
+ */
53
+ {
54
+ ZSTD_thread_params_t* thread_param = (ZSTD_thread_params_t*)arg;
55
+ thread_arg = thread_param->arg;
56
+ start_routine = thread_param->start_routine;
57
+
58
+ /* Signal main thread that we are running and do not depend on its memory anymore */
59
+ ZSTD_pthread_mutex_lock(&thread_param->initialized_mutex);
60
+ thread_param->initialized = 1;
61
+ ZSTD_pthread_cond_signal(&thread_param->initialized_cond);
62
+ ZSTD_pthread_mutex_unlock(&thread_param->initialized_mutex);
63
+ }
64
+
65
+ start_routine(thread_arg);
66
+
67
+ return 0;
68
+ }
69
+
70
+ int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused,
71
+ void* (*start_routine) (void*), void* arg)
72
+ {
73
+ ZSTD_thread_params_t thread_param;
74
+ (void)unused;
75
+
76
+ if (thread==NULL) return -1;
77
+ *thread = NULL;
78
+
79
+ thread_param.start_routine = start_routine;
80
+ thread_param.arg = arg;
81
+ thread_param.initialized = 0;
82
+
83
+ /* Setup thread initialization synchronization */
84
+ if(ZSTD_pthread_cond_init(&thread_param.initialized_cond, NULL)) {
85
+ /* Should never happen on Windows */
86
+ return -1;
87
+ }
88
+ if(ZSTD_pthread_mutex_init(&thread_param.initialized_mutex, NULL)) {
89
+ /* Should never happen on Windows */
90
+ ZSTD_pthread_cond_destroy(&thread_param.initialized_cond);
91
+ return -1;
92
+ }
93
+
94
+ /* Spawn thread */
95
+ *thread = (HANDLE)_beginthreadex(NULL, 0, worker, &thread_param, 0, NULL);
96
+ if (*thread==NULL) {
97
+ ZSTD_pthread_mutex_destroy(&thread_param.initialized_mutex);
98
+ ZSTD_pthread_cond_destroy(&thread_param.initialized_cond);
99
+ return errno;
100
+ }
101
+
102
+ /* Wait for thread to be initialized */
103
+ ZSTD_pthread_mutex_lock(&thread_param.initialized_mutex);
104
+ while(!thread_param.initialized) {
105
+ ZSTD_pthread_cond_wait(&thread_param.initialized_cond, &thread_param.initialized_mutex);
106
+ }
107
+ ZSTD_pthread_mutex_unlock(&thread_param.initialized_mutex);
108
+ ZSTD_pthread_mutex_destroy(&thread_param.initialized_mutex);
109
+ ZSTD_pthread_cond_destroy(&thread_param.initialized_cond);
110
+
111
+ return 0;
112
+ }
113
+
114
+ int ZSTD_pthread_join(ZSTD_pthread_t thread)
115
+ {
116
+ DWORD result;
117
+
118
+ if (!thread) return 0;
119
+
120
+ result = WaitForSingleObject(thread, INFINITE);
121
+ CloseHandle(thread);
122
+
123
+ switch (result) {
124
+ case WAIT_OBJECT_0:
125
+ return 0;
126
+ case WAIT_ABANDONED:
127
+ return EINVAL;
128
+ default:
129
+ return GetLastError();
130
+ }
131
+ }
132
+
133
+ #endif /* ZSTD_MULTITHREAD */
134
+
135
+ #if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32)
136
+
137
+ #define ZSTD_DEPS_NEED_MALLOC
138
+ #include "zstd_deps.h"
139
+
140
+ int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr)
141
+ {
142
+ assert(mutex != NULL);
143
+ *mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t));
144
+ if (!*mutex)
145
+ return 1;
146
+ return pthread_mutex_init(*mutex, attr);
147
+ }
148
+
149
+ int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex)
150
+ {
151
+ assert(mutex != NULL);
152
+ if (!*mutex)
153
+ return 0;
154
+ {
155
+ int const ret = pthread_mutex_destroy(*mutex);
156
+ ZSTD_free(*mutex);
157
+ return ret;
158
+ }
159
+ }
160
+
161
+ int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr)
162
+ {
163
+ assert(cond != NULL);
164
+ *cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t));
165
+ if (!*cond)
166
+ return 1;
167
+ return pthread_cond_init(*cond, attr);
168
+ }
169
+
170
+ int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond)
171
+ {
172
+ assert(cond != NULL);
173
+ if (!*cond)
174
+ return 0;
175
+ {
176
+ int const ret = pthread_cond_destroy(*cond);
177
+ ZSTD_free(*cond);
178
+ return ret;
179
+ }
180
+ }
181
+
182
+ #endif
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Copyright (c) 2016 Tino Reichardt
3
+ * All rights reserved.
4
+ *
5
+ * You can contact the author at:
6
+ * - zstdmt source repository: https://github.com/mcmilk/zstdmt
7
+ *
8
+ * This source code is licensed under both the BSD-style license (found in the
9
+ * LICENSE file in the root directory of this source tree) and the GPLv2 (found
10
+ * in the COPYING file in the root directory of this source tree).
11
+ * You may select, at your option, one of the above-listed licenses.
12
+ */
13
+
14
+ #ifndef THREADING_H_938743
15
+ #define THREADING_H_938743
16
+
17
+ #include "debug.h"
18
+
19
+ #if defined (__cplusplus)
20
+ extern "C" {
21
+ #endif
22
+
23
+ #if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
24
+
25
+ /**
26
+ * Windows minimalist Pthread Wrapper
27
+ */
28
+ #ifdef WINVER
29
+ # undef WINVER
30
+ #endif
31
+ #define WINVER 0x0600
32
+
33
+ #ifdef _WIN32_WINNT
34
+ # undef _WIN32_WINNT
35
+ #endif
36
+ #define _WIN32_WINNT 0x0600
37
+
38
+ #ifndef WIN32_LEAN_AND_MEAN
39
+ # define WIN32_LEAN_AND_MEAN
40
+ #endif
41
+
42
+ #undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */
43
+ #include <windows.h>
44
+ #undef ERROR
45
+ #define ERROR(name) ZSTD_ERROR(name)
46
+
47
+
48
+ /* mutex */
49
+ #define ZSTD_pthread_mutex_t CRITICAL_SECTION
50
+ #define ZSTD_pthread_mutex_init(a, b) ((void)(b), InitializeCriticalSection((a)), 0)
51
+ #define ZSTD_pthread_mutex_destroy(a) DeleteCriticalSection((a))
52
+ #define ZSTD_pthread_mutex_lock(a) EnterCriticalSection((a))
53
+ #define ZSTD_pthread_mutex_unlock(a) LeaveCriticalSection((a))
54
+
55
+ /* condition variable */
56
+ #define ZSTD_pthread_cond_t CONDITION_VARIABLE
57
+ #define ZSTD_pthread_cond_init(a, b) ((void)(b), InitializeConditionVariable((a)), 0)
58
+ #define ZSTD_pthread_cond_destroy(a) ((void)(a))
59
+ #define ZSTD_pthread_cond_wait(a, b) SleepConditionVariableCS((a), (b), INFINITE)
60
+ #define ZSTD_pthread_cond_signal(a) WakeConditionVariable((a))
61
+ #define ZSTD_pthread_cond_broadcast(a) WakeAllConditionVariable((a))
62
+
63
+ /* ZSTD_pthread_create() and ZSTD_pthread_join() */
64
+ typedef HANDLE ZSTD_pthread_t;
65
+
66
+ int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused,
67
+ void* (*start_routine) (void*), void* arg);
68
+
69
+ int ZSTD_pthread_join(ZSTD_pthread_t thread);
70
+
71
+ /**
72
+ * add here more wrappers as required
73
+ */
74
+
75
+
76
+ #elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection method */
77
+ /* === POSIX Systems === */
78
+ # include <pthread.h>
79
+
80
+ #if DEBUGLEVEL < 1
81
+
82
+ #define ZSTD_pthread_mutex_t pthread_mutex_t
83
+ #define ZSTD_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
84
+ #define ZSTD_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
85
+ #define ZSTD_pthread_mutex_lock(a) pthread_mutex_lock((a))
86
+ #define ZSTD_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
87
+
88
+ #define ZSTD_pthread_cond_t pthread_cond_t
89
+ #define ZSTD_pthread_cond_init(a, b) pthread_cond_init((a), (b))
90
+ #define ZSTD_pthread_cond_destroy(a) pthread_cond_destroy((a))
91
+ #define ZSTD_pthread_cond_wait(a, b) pthread_cond_wait((a), (b))
92
+ #define ZSTD_pthread_cond_signal(a) pthread_cond_signal((a))
93
+ #define ZSTD_pthread_cond_broadcast(a) pthread_cond_broadcast((a))
94
+
95
+ #define ZSTD_pthread_t pthread_t
96
+ #define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d))
97
+ #define ZSTD_pthread_join(a) pthread_join((a),NULL)
98
+
99
+ #else /* DEBUGLEVEL >= 1 */
100
+
101
+ /* Debug implementation of threading.
102
+ * In this implementation we use pointers for mutexes and condition variables.
103
+ * This way, if we forget to init/destroy them the program will crash or ASAN
104
+ * will report leaks.
105
+ */
106
+
107
+ #define ZSTD_pthread_mutex_t pthread_mutex_t*
108
+ int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr);
109
+ int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex);
110
+ #define ZSTD_pthread_mutex_lock(a) pthread_mutex_lock(*(a))
111
+ #define ZSTD_pthread_mutex_unlock(a) pthread_mutex_unlock(*(a))
112
+
113
+ #define ZSTD_pthread_cond_t pthread_cond_t*
114
+ int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr);
115
+ int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond);
116
+ #define ZSTD_pthread_cond_wait(a, b) pthread_cond_wait(*(a), *(b))
117
+ #define ZSTD_pthread_cond_signal(a) pthread_cond_signal(*(a))
118
+ #define ZSTD_pthread_cond_broadcast(a) pthread_cond_broadcast(*(a))
119
+
120
+ #define ZSTD_pthread_t pthread_t
121
+ #define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d))
122
+ #define ZSTD_pthread_join(a) pthread_join((a),NULL)
123
+
124
+ #endif
125
+
126
+ #else /* ZSTD_MULTITHREAD not defined */
127
+ /* No multithreading support */
128
+
129
+ typedef int ZSTD_pthread_mutex_t;
130
+ #define ZSTD_pthread_mutex_init(a, b) ((void)(a), (void)(b), 0)
131
+ #define ZSTD_pthread_mutex_destroy(a) ((void)(a))
132
+ #define ZSTD_pthread_mutex_lock(a) ((void)(a))
133
+ #define ZSTD_pthread_mutex_unlock(a) ((void)(a))
134
+
135
+ typedef int ZSTD_pthread_cond_t;
136
+ #define ZSTD_pthread_cond_init(a, b) ((void)(a), (void)(b), 0)
137
+ #define ZSTD_pthread_cond_destroy(a) ((void)(a))
138
+ #define ZSTD_pthread_cond_wait(a, b) ((void)(a), (void)(b))
139
+ #define ZSTD_pthread_cond_signal(a) ((void)(a))
140
+ #define ZSTD_pthread_cond_broadcast(a) ((void)(a))
141
+
142
+ /* do not use ZSTD_pthread_t */
143
+
144
+ #endif /* ZSTD_MULTITHREAD */
145
+
146
+ #if defined (__cplusplus)
147
+ }
148
+ #endif
149
+
150
+ #endif /* THREADING_H_938743 */
@@ -0,0 +1,18 @@
1
+ /*
2
+ * xxHash - Extremely Fast Hash algorithm
3
+ * Copyright (c) Yann Collet - Meta Platforms, Inc
4
+ *
5
+ * This source code is licensed under both the BSD-style license (found in the
6
+ * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7
+ * in the COPYING file in the root directory of this source tree).
8
+ * You may select, at your option, one of the above-listed licenses.
9
+ */
10
+
11
+ /*
12
+ * xxhash.c instantiates functions defined in xxhash.h
13
+ */
14
+
15
+ #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */
16
+ #define XXH_IMPLEMENTATION /* access definitions */
17
+
18
+ #include "xxhash.h"