yencode 1.0.8 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +339 -231
  2. package/binding.gyp +292 -39
  3. package/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.cc +7 -7
  4. package/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.cc +14 -14
  5. package/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.cc +1 -1
  6. package/crcutil-1.0/code/uint128_sse2.h +2 -0
  7. package/index.js +329 -22
  8. package/package.json +2 -2
  9. package/src/common.h +299 -0
  10. package/src/crc.cc +95 -0
  11. package/src/crc.h +23 -0
  12. package/src/crc_arm.cc +175 -0
  13. package/src/crc_common.h +4 -0
  14. package/{crc_folding.c → src/crc_folding.cc} +175 -185
  15. package/src/decoder.cc +61 -0
  16. package/src/decoder.h +53 -0
  17. package/src/decoder_avx.cc +18 -0
  18. package/src/decoder_avx2.cc +18 -0
  19. package/src/decoder_avx2_base.h +615 -0
  20. package/src/decoder_common.h +512 -0
  21. package/src/decoder_neon.cc +474 -0
  22. package/src/decoder_neon64.cc +451 -0
  23. package/src/decoder_sse2.cc +16 -0
  24. package/src/decoder_sse_base.h +711 -0
  25. package/src/decoder_ssse3.cc +18 -0
  26. package/src/encoder.cc +170 -0
  27. package/src/encoder.h +21 -0
  28. package/src/encoder_avx.cc +16 -0
  29. package/src/encoder_avx2.cc +16 -0
  30. package/src/encoder_avx_base.h +564 -0
  31. package/src/encoder_common.h +109 -0
  32. package/src/encoder_neon.cc +547 -0
  33. package/src/encoder_sse2.cc +13 -0
  34. package/src/encoder_sse_base.h +724 -0
  35. package/src/encoder_ssse3.cc +18 -0
  36. package/src/hedley.h +1899 -0
  37. package/src/platform.cc +147 -0
  38. package/src/yencode.cc +449 -0
  39. package/test/_maxsize.js +9 -0
  40. package/test/_speedbase.js +147 -0
  41. package/test/speedcrc.js +20 -0
  42. package/test/speeddec.js +92 -0
  43. package/test/speedenc.js +44 -0
  44. package/{testcrc.js → test/testcrc.js} +53 -39
  45. package/test/testdec.js +183 -0
  46. package/test/testenc.js +163 -0
  47. package/test/testpostdec.js +126 -0
  48. package/test.js +0 -91
  49. package/yencode.cc +0 -1622
package/binding.gyp CHANGED
@@ -1,40 +1,293 @@
1
- {
2
- "targets": [
3
- {
4
- "target_name": "yencode",
5
- "dependencies": ["crcutil"],
6
- "sources": ["yencode.cc"],
7
- "conditions": [
8
- ['OS=="win"', {
9
- "msvs_settings": {"VCCLCompilerTool": {"EnableEnhancedInstructionSet": "2"}}
10
- }, {
11
- "cflags": ["-march=native", "-O2"],
12
- "cxxflags": ["-march=native", "-O2"]
13
- }]
14
- ],
15
- "include_dirs": ["crcutil-1.0/code","crcutil-1.0/examples"]
16
- },
17
- {
18
- "target_name": "crcutil",
19
- "type": "static_library",
20
- "sources": [
21
- "crcutil-1.0/code/crc32c_sse4.cc",
22
- "crcutil-1.0/code/multiword_64_64_cl_i386_mmx.cc",
23
- "crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.cc",
24
- "crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.cc",
25
- "crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.cc",
26
- "crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.cc",
27
- "crcutil-1.0/examples/interface.cc"
28
- ],
29
- "conditions": [
30
- ['OS=="win"', {
31
- "msvs_settings": {"VCCLCompilerTool": {"EnableEnhancedInstructionSet": "2"}}
32
- }, {
33
- "cxxflags": ["-march=native", "-O3", "-fomit-frame-pointer"]
34
- }]
35
- ],
36
- "include_dirs": ["crcutil-1.0/code", "crcutil-1.0/tests"],
37
- "defines": ["CRCUTIL_USE_MM_CRC32=0"]
38
- }
39
- ]
1
+ {
2
+ "variables": {
3
+ "enable_native_tuning%": 1,
4
+ "disable_avx256%": 0
5
+ },
6
+ "target_defaults": {
7
+ "conditions": [
8
+ ['target_arch=="ia32"', {
9
+ "msvs_settings": {"VCCLCompilerTool": {"EnableEnhancedInstructionSet": "2"}}
10
+ }],
11
+ ['OS!="win" and enable_native_tuning!=0', {
12
+ "variables": {
13
+ "supports_native%": "<!(<!(echo ${CXX_target:-${CXX:-c++}}) -MM -E src/common.h -march=native 2>/dev/null || true)"
14
+ },
15
+ "conditions": [
16
+ ['supports_native!=""', {
17
+ "cflags": ["-march=native"],
18
+ "cxxflags": ["-march=native"],
19
+ "xcode_settings": {
20
+ "OTHER_CFLAGS": ["-march=native"],
21
+ "OTHER_CXXFLAGS": ["-march=native"],
22
+ }
23
+ }]
24
+ ]
25
+ }],
26
+ ['OS!="win" and target_arch in "ia32 x64" and enable_native_tuning==0', {
27
+ "variables": {
28
+ "supports_avx2_nosplit%": "<!(<!(echo ${CXX_target:-${CXX:-c++}}) -MM -E src/common.h -mavx2 -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store 2>/dev/null || true)"
29
+ },
30
+ "conditions": [
31
+ ['supports_avx2_nosplit!=""', {
32
+ "cflags": ["-mno-avx256-split-unaligned-load", "-mno-avx256-split-unaligned-store"],
33
+ "cxxflags": ["-mno-avx256-split-unaligned-load", "-mno-avx256-split-unaligned-store"],
34
+ "xcode_settings": {
35
+ "OTHER_CFLAGS": ["-mno-avx256-split-unaligned-load", "-mno-avx256-split-unaligned-store"],
36
+ "OTHER_CXXFLAGS": ["-mno-avx256-split-unaligned-load", "-mno-avx256-split-unaligned-store"],
37
+ }
38
+ }]
39
+ ]
40
+ }],
41
+ ['disable_avx256!=0', {
42
+ "defines": ["YENC_DISABLE_AVX256=1"]
43
+ }],
44
+ ['OS!="win" and enable_native_tuning!=0', {
45
+ "defines": ["YENC_BUILD_NATIVE=1"]
46
+ }]
47
+ ],
48
+ "cflags": ["-Wno-unused-function"],
49
+ "cxxflags": ["-Wno-unused-function"],
50
+ "xcode_settings": {
51
+ "OTHER_CFLAGS": ["-Wno-unused-function"],
52
+ "OTHER_CXXFLAGS": ["-Wno-unused-function"]
53
+ },
54
+ "msvs_settings": {"VCCLCompilerTool": {"Optimization": "MaxSpeed"}},
55
+ "configurations": {"Release": {
56
+ "cflags": ["-fomit-frame-pointer"],
57
+ "cxxflags": ["-fomit-frame-pointer"],
58
+ "xcode_settings": {
59
+ "OTHER_CFLAGS": ["-fomit-frame-pointer"],
60
+ "OTHER_CXXFLAGS": ["-fomit-frame-pointer"]
61
+ }
62
+ }}
63
+ },
64
+ "targets": [
65
+ {
66
+ "target_name": "yencode",
67
+ "dependencies": ["crcutil", "yencode_sse2", "yencode_ssse3", "yencode_clmul", "yencode_avx", "yencode_avx2", "yencode_neon", "yencode_armcrc"],
68
+ "sources": [
69
+ "src/yencode.cc",
70
+ "src/platform.cc",
71
+ "src/encoder.cc",
72
+ "src/decoder.cc",
73
+ "src/crc.cc"
74
+ ],
75
+ "include_dirs": ["crcutil-1.0/code","crcutil-1.0/examples"]
76
+ },
77
+ {
78
+ "target_name": "yencode_sse2",
79
+ "type": "static_library",
80
+ "sources": [
81
+ "src/encoder_sse2.cc",
82
+ "src/decoder_sse2.cc"
83
+ ],
84
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
85
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
86
+ "xcode_settings": {
87
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
88
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
89
+ },
90
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
91
+ "conditions": [
92
+ ['target_arch in "ia32 x64"', {
93
+ "cflags": ["-msse2"],
94
+ "cxxflags": ["-msse2"],
95
+ "xcode_settings": {
96
+ "OTHER_CFLAGS": ["-msse2"],
97
+ "OTHER_CXXFLAGS": ["-msse2"],
98
+ }
99
+ }]
100
+ ]
101
+ },
102
+ {
103
+ "target_name": "yencode_ssse3",
104
+ "type": "static_library",
105
+ "sources": [
106
+ "src/encoder_ssse3.cc",
107
+ "src/decoder_ssse3.cc"
108
+ ],
109
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
110
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
111
+ "xcode_settings": {
112
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
113
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
114
+ },
115
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
116
+ "conditions": [
117
+ ['target_arch in "ia32 x64"', {
118
+ "cflags": ["-mssse3"],
119
+ "cxxflags": ["-mssse3"],
120
+ "xcode_settings": {
121
+ "OTHER_CFLAGS": ["-mssse3"],
122
+ "OTHER_CXXFLAGS": ["-mssse3"],
123
+ }
124
+ }]
125
+ ]
126
+ },
127
+ {
128
+ "target_name": "yencode_clmul",
129
+ "type": "static_library",
130
+ "sources": [
131
+ "src/crc_folding.cc"
132
+ ],
133
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
134
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
135
+ "xcode_settings": {
136
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
137
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
138
+ },
139
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
140
+ "conditions": [
141
+ ['target_arch in "ia32 x64"', {
142
+ "cflags": ["-mssse3", "-msse4.1", "-mpclmul"],
143
+ "cxxflags": ["-mssse3", "-msse4.1", "-mpclmul"],
144
+ "xcode_settings": {
145
+ "OTHER_CFLAGS": ["-mssse3", "-msse4.1", "-mpclmul"],
146
+ "OTHER_CXXFLAGS": ["-mssse3", "-msse4.1", "-mpclmul"],
147
+ }
148
+ }]
149
+ ]
150
+ },
151
+ {
152
+ "target_name": "yencode_avx",
153
+ "type": "static_library",
154
+ "sources": [
155
+ "src/encoder_avx.cc",
156
+ "src/decoder_avx.cc"
157
+ ],
158
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
159
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
160
+ "xcode_settings": {
161
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
162
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
163
+ },
164
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
165
+ "conditions": [
166
+ ['target_arch in "ia32 x64"', {
167
+ "msvs_settings": {"VCCLCompilerTool": {"EnableEnhancedInstructionSet": "3"}},
168
+ "cflags": ["-mavx", "-mpopcnt"],
169
+ "cxxflags": ["-mavx", "-mpopcnt"],
170
+ "xcode_settings": {
171
+ "OTHER_CFLAGS": ["-mavx", "-mpopcnt"],
172
+ "OTHER_CXXFLAGS": ["-mavx", "-mpopcnt"],
173
+ }
174
+ }]
175
+ ]
176
+ },
177
+ {
178
+ "target_name": "yencode_avx2",
179
+ "type": "static_library",
180
+ "sources": [
181
+ "src/decoder_avx2.cc", "src/encoder_avx2.cc"
182
+ ],
183
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
184
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
185
+ "xcode_settings": {
186
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
187
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
188
+ },
189
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
190
+ "conditions": [
191
+ ['target_arch in "ia32 x64" and OS!="win"', {
192
+ "variables": {"supports_avx2%": "<!(<!(echo ${CXX_target:-${CXX:-c++}}) -MM -E src/decoder_avx2.cc -mavx2 2>/dev/null || true)"},
193
+ "conditions": [
194
+ ['supports_avx2!=""', {
195
+ "cflags": ["-mavx2", "-mpopcnt", "-mbmi", "-mbmi2", "-mlzcnt"],
196
+ "cxxflags": ["-mavx2", "-mpopcnt", "-mbmi", "-mbmi2", "-mlzcnt"],
197
+ "xcode_settings": {
198
+ "OTHER_CFLAGS": ["-mavx2", "-mpopcnt", "-mbmi", "-mbmi2", "-mlzcnt"],
199
+ "OTHER_CXXFLAGS": ["-mavx2", "-mpopcnt", "-mbmi", "-mbmi2", "-mlzcnt"],
200
+ }
201
+ }]
202
+ ]
203
+ }],
204
+ ['target_arch in "ia32 x64" and OS=="win"', {
205
+ "msvs_settings": {"VCCLCompilerTool": {"EnableEnhancedInstructionSet": "3"}}
206
+ }]
207
+ ]
208
+ },
209
+ {
210
+ "target_name": "yencode_neon",
211
+ "type": "static_library",
212
+ "sources": [
213
+ "src/encoder_neon.cc"
214
+ ],
215
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
216
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
217
+ "xcode_settings": {
218
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
219
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
220
+ },
221
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
222
+ "conditions": [
223
+ ['target_arch=="arm"', {
224
+ "cflags": ["-mfpu=neon"],
225
+ "cxxflags": ["-mfpu=neon"],
226
+ "xcode_settings": {
227
+ "OTHER_CFLAGS": ["-mfpu=neon"],
228
+ "OTHER_CXXFLAGS": ["-mfpu=neon"],
229
+ }
230
+ }],
231
+ ['target_arch=="arm64"', {
232
+ "sources": ["src/decoder_neon64.cc"]
233
+ }, {
234
+ "sources": ["src/decoder_neon.cc"]
235
+ }]
236
+ ]
237
+ },
238
+ {
239
+ "target_name": "yencode_armcrc",
240
+ "type": "static_library",
241
+ "sources": [
242
+ "src/crc_arm.cc"
243
+ ],
244
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
245
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
246
+ "xcode_settings": {
247
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
248
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
249
+ },
250
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
251
+ "conditions": [
252
+ ['target_arch in "arm arm64"', {
253
+ "cflags!": ["-march=native"],
254
+ "cxxflags!": ["-march=native"],
255
+ "cflags": ["-march=armv8-a+crc"],
256
+ "cxxflags": ["-march=armv8-a+crc"],
257
+ "xcode_settings": {
258
+ "OTHER_CFLAGS!": ["-march=native"],
259
+ "OTHER_CXXFLAGS!": ["-march=native"],
260
+ "OTHER_CFLAGS": ["-march=armv8-a+crc"],
261
+ "OTHER_CXXFLAGS": ["-march=armv8-a+crc"],
262
+ }
263
+ }]
264
+ ]
265
+ },
266
+ {
267
+ "target_name": "crcutil",
268
+ "type": "static_library",
269
+ "sources": [
270
+ "crcutil-1.0/code/crc32c_sse4.cc",
271
+ "crcutil-1.0/code/multiword_64_64_cl_i386_mmx.cc",
272
+ "crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.cc",
273
+ "crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.cc",
274
+ "crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.cc",
275
+ "crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.cc",
276
+ "crcutil-1.0/examples/interface.cc"
277
+ ],
278
+ "cflags": ["-fomit-frame-pointer", "-Wno-expansion-to-defined"],
279
+ "cxxflags": ["-fomit-frame-pointer", "-Wno-expansion-to-defined"],
280
+ "cflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
281
+ "cxxflags!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
282
+ "xcode_settings": {
283
+ "OTHER_CFLAGS": ["-fomit-frame-pointer", "-Wno-expansion-to-defined"],
284
+ "OTHER_CXXFLAGS": ["-fomit-frame-pointer", "-Wno-expansion-to-defined"],
285
+ "OTHER_CFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"],
286
+ "OTHER_CXXFLAGS!": ["-fno-omit-frame-pointer", "-fno-tree-vrp", "-fno-strict-aliasing"]
287
+ },
288
+ "msvs_settings": {"VCCLCompilerTool": {"BufferSecurityCheck": "false"}},
289
+ "include_dirs": ["crcutil-1.0/code", "crcutil-1.0/tests"],
290
+ "defines": ["CRCUTIL_USE_MM_CRC32=0"]
291
+ }
292
+ ]
40
293
  }
@@ -142,7 +142,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordGccAmd64(
142
142
  uint64 crc3;
143
143
 
144
144
  asm(
145
- "sub $2*4*8 - 1, %[end]\n"
145
+ "subq $2*4*8 - 1, %[end]\n"
146
146
  "cmpq %[src], %[end]\n"
147
147
  "jbe 2f\n"
148
148
  "xorq %[crc1], %[crc1]\n"
@@ -157,7 +157,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordGccAmd64(
157
157
  #if HAVE_SSE && CRCUTIL_PREFETCH_WIDTH > 0
158
158
  "prefetcht0 " TO_STRING(CRCUTIL_PREFETCH_WIDTH) "(%[src])\n"
159
159
  #endif // HAVE_SSE
160
- "add $4*8, %[src]\n"
160
+ "addq $4*8, %[src]\n"
161
161
 
162
162
  // Set buffer data.
163
163
  "xorq %[crc0], " BUF0 "\n"
@@ -237,22 +237,22 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordGccAmd64(
237
237
  "movq " BUF3 ", " BUF0 "\n"
238
238
  CRC_WORD_ASM()
239
239
 
240
- "add $4*8, %[src]\n"
240
+ "addq $4*8, %[src]\n"
241
241
 
242
242
  "2:\n"
243
- "add $2*4*8 - 8, %[end]\n"
243
+ "addq $2*4*8 - 8, %[end]\n"
244
244
  "cmpq %[src], %[end]\n"
245
245
  "jbe 4f\n"
246
246
 
247
247
  "3:\n"
248
248
  "movq (%[src]), " BUF0 "\n"
249
- "add $8, %[src]\n"
249
+ "addq $8, %[src]\n"
250
250
  CRC_WORD_ASM()
251
251
  "cmpq %[src], %[end]\n"
252
252
  "ja 3b\n"
253
253
 
254
254
  "4:\n"
255
- "add $7, %[end]\n"
255
+ "addq $7, %[end]\n"
256
256
 
257
257
  "cmpq %[src], %[end]\n"
258
258
  "jbe 6f\n"
@@ -262,7 +262,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordGccAmd64(
262
262
  "movzbq %b[crc0], " TMP0 "\n"
263
263
  "shrq $8, %[crc0]\n"
264
264
  "xorq " BUF0 ", " TMP0 "\n"
265
- "add $1, %[src]\n"
265
+ "addq $1, %[src]\n"
266
266
  "xorq 7*256*8(%[table_word], " TMP0 ", 8), %[crc0]\n"
267
267
  "cmpq %[src], %[end]\n"
268
268
  "ja 5b\n"
@@ -16,7 +16,7 @@
16
16
 
17
17
  #include "generic_crc.h"
18
18
 
19
- #if defined(__GNUC__) && CRCUTIL_USE_ASM && HAVE_I386 && HAVE_MMX
19
+ #if defined(__GNUC__) && !defined(__clang__) && CRCUTIL_USE_ASM && HAVE_I386 && HAVE_MMX
20
20
 
21
21
  #if defined(__PIC__) && __GNUC__ < 5
22
22
  /* workaround for issue with PIC reserving ebx: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54232 */
@@ -111,7 +111,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
111
111
  #define TMP3 "%[tmp3]"
112
112
  #define TMP3b "%b[tmp3]"
113
113
  #endif
114
- "sub $2*4*8 - 1, %[end]\n"
114
+ "subl $2*4*8 - 1, %[end]\n"
115
115
  "cmpl %[src], %[end]\n"
116
116
  "jbe 2f\n"
117
117
 
@@ -140,7 +140,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
140
140
  "psrlq $32, %[buf1]\n"
141
141
  "movd %[buf2], %[tmp2]\n"
142
142
  "psrlq $32, %[buf2]\n"
143
- "movd %[buf3], "TMP3"\n"
143
+ "movd %[buf3], " TMP3 "\n"
144
144
  "psrlq $32, %[buf3]\n"
145
145
 
146
146
  "movzbl %b[tmp0], %[temp]\n"
@@ -152,8 +152,8 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
152
152
  "movzbl %b[tmp2], %[temp]\n"
153
153
  "shrl $8, %[tmp2]\n"
154
154
  "movq (%[table], %[temp], 8), %[crc2]\n"
155
- "movzbl "TMP3b", %[temp]\n"
156
- "shrl $8, "TMP3"\n"
155
+ "movzbl " TMP3b ", %[temp]\n"
156
+ "shrl $8, " TMP3 "\n"
157
157
  "movq (%[table], %[temp], 8), %[crc3]\n"
158
158
 
159
159
  #define XOR(byte) \
@@ -166,8 +166,8 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
166
166
  "movzbl %b[tmp2], %[temp]\n" \
167
167
  "shrl $8, %[tmp2]\n" \
168
168
  "pxor " #byte "*256*8(%[table], %[temp], 8), %[crc2]\n" \
169
- "movzbl "TMP3b", %[temp]\n" \
170
- "shrl $8, "TMP3"\n" \
169
+ "movzbl " TMP3b ", %[temp]\n" \
170
+ "shrl $8, " TMP3 "\n" \
171
171
  "pxor " #byte "*256*8(%[table], %[temp], 8), %[crc3]\n"
172
172
 
173
173
  XOR(1)
@@ -179,8 +179,8 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
179
179
  "movd %[buf1], %[tmp1]\n"
180
180
  "pxor 3*256*8(%[table], %[tmp2], 8), %[crc2]\n"
181
181
  "movd %[buf2], %[tmp2]\n"
182
- "pxor 3*256*8(%[table], "TMP3", 8), %[crc3]\n"
183
- "movd %[buf3], "TMP3"\n"
182
+ "pxor 3*256*8(%[table], " TMP3 ", 8), %[crc3]\n"
183
+ "movd %[buf3], " TMP3 "\n"
184
184
 
185
185
  XOR(4)
186
186
  XOR(5)
@@ -192,7 +192,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
192
192
  "movq 1*8(%[src]), %[buf1]\n"
193
193
  "pxor 7*256*8(%[table], %[tmp2], 8), %[crc2]\n"
194
194
  "movq 2*8(%[src]), %[buf2]\n"
195
- "pxor 7*256*8(%[table], "TMP3", 8), %[crc3]\n"
195
+ "pxor 7*256*8(%[table], " TMP3 ", 8), %[crc3]\n"
196
196
  "movq 3*8(%[src]), %[buf3]\n"
197
197
  "cmpl %[src], %[end]\n"
198
198
  "ja 1b\n"
@@ -213,11 +213,11 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
213
213
  "movq %[buf3], %[buf0]\n"
214
214
  CRC_WORD_MMX()
215
215
 
216
- "add $4*8, %[src]\n"
216
+ "addl $4*8, %[src]\n"
217
217
  "2:\n"
218
218
  "movl %[table_word], %[table]\n"
219
219
 
220
- "add $2*4*8 - 8, %[end]\n"
220
+ "addl $2*4*8 - 8, %[end]\n"
221
221
  "cmpl %[src], %[end]\n"
222
222
  "jbe 4f\n"
223
223
  "3:\n"
@@ -227,7 +227,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
227
227
  "cmpl %[src], %[end]\n"
228
228
  "ja 3b\n"
229
229
  "4:\n"
230
- "add $7, %[end]\n"
230
+ "addl $7, %[end]\n"
231
231
 
232
232
  "cmpl %[src], %[end]\n"
233
233
  "jbe 6f\n"
@@ -238,7 +238,7 @@ template<> uint64 GenericCrc<uint64, uint64, uint64, 4>::CrcMultiwordI386Mmx(
238
238
  "movzbl %b[tmp0], %[tmp0]\n"
239
239
  "psrlq $8, %[crc0]\n"
240
240
  "xorl %[tmp0], %[temp]\n"
241
- "add $1, %[src]\n"
241
+ "addl $1, %[src]\n"
242
242
  "pxor 7*256*8(%[table], %[temp], 8), %[crc0]\n"
243
243
  "cmpl %[src], %[end]\n"
244
244
  "ja 5b\n"
@@ -16,7 +16,7 @@
16
16
 
17
17
  #include "generic_crc.h"
18
18
 
19
- #if CRCUTIL_USE_ASM && HAVE_I386 && HAVE_MMX
19
+ #if CRCUTIL_USE_ASM && HAVE_I386 && HAVE_MMX && !defined(_MSC_VER) && !(defined(__GNUC__) && !defined(__clang__))
20
20
 
21
21
  namespace crcutil {
22
22
 
@@ -70,6 +70,8 @@ class uint128_sse2 {
70
70
  }
71
71
  __forceinline uint128_sse2(const __m128i x) : x_(x) {
72
72
  }
73
+ __forceinline uint128_sse2(const uint128_sse2& x) : x_(x.x_) {
74
+ }
73
75
  __forceinline operator __m128i() const {
74
76
  return x_;
75
77
  }