@@ -124,10 +124,14 @@ using std::size_t;
124
124
#ifdef __clang__
125
125
// clang under visual studio
126
126
#define SIMDJSON_CLANG_VISUAL_STUDIO 1
127
+ #define SIMDJSON_REGULAR_VISUAL_STUDIO 0
127
128
#else
128
129
// just regular visual studio (best guess)
130
+ #define SIMDJSON_CLANG_VISUAL_STUDIO 0
129
131
#define SIMDJSON_REGULAR_VISUAL_STUDIO 1
130
132
#endif // __clang__
133
+ #else
134
+ #define SIMDJSON_VISUAL_STUDIO 0
131
135
#endif // _MSC_VER
132
136
133
137
#if (defined(__x86_64__) || defined(_M_AMD64)) && !defined(_M_ARM64EC)
@@ -158,6 +162,26 @@ using std::size_t;
158
162
#define SIMDJSON_IS_32BITS 0
159
163
#endif
160
164
165
+ #ifndef SIMDJSON_IS_X86_64
166
+ #define SIMDJSON_IS_X86_64 0
167
+ #endif
168
+
169
+ #ifndef SIMDJSON_IS_ARM64
170
+ #define SIMDJSON_IS_ARM64 0
171
+ #endif
172
+
173
+ #ifndef SIMDJSON_IS_RISCV64
174
+ #define SIMDJSON_IS_RISCV64 0
175
+ #endif
176
+
177
+ #ifndef SIMDJSON_IS_LOONGARCH64
178
+ #define SIMDJSON_IS_LOONGARCH64 0
179
+ #endif
180
+
181
+ #ifndef SIMDJSON_IS_PPC64_VMX
182
+ #define SIMDJSON_IS_PPC64_VMX 0
183
+ #endif
184
+
161
185
#if SIMDJSON_IS_32BITS
162
186
#ifndef SIMDJSON_NO_PORTABILITY_WARNING
163
187
// In the future, we should allow programmers
@@ -7788,7 +7812,7 @@ SIMDJSON_NO_SANITIZE_UNDEFINED
7788
7812
// See issue https://github.com/simdjson/simdjson/issues/1965
7789
7813
SIMDJSON_NO_SANITIZE_MEMORY
7790
7814
simdjson_inline int trailing_zeroes(uint64_t input_num) {
7791
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
7815
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
7792
7816
unsigned long ret;
7793
7817
// Search the mask data from least significant bit (LSB)
7794
7818
// to the most significant bit (MSB) for a set bit (1).
@@ -7812,7 +7836,7 @@ simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) {
7812
7836
SIMDJSON_NO_SANITIZE_UNDEFINED
7813
7837
/* result might be undefined when input_num is zero */
7814
7838
simdjson_inline int leading_zeroes(uint64_t input_num) {
7815
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
7839
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
7816
7840
unsigned long leading_zero = 0;
7817
7841
// Search the mask data from most significant bit (MSB)
7818
7842
// to least significant bit (LSB) for a set bit (1).
@@ -7865,7 +7889,7 @@ simdjson_inline uint64_t zero_leading_bit(uint64_t rev_bits, int leading_zeroes)
7865
7889
#endif
7866
7890
7867
7891
simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2, uint64_t *result) {
7868
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
7892
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
7869
7893
*result = value1 + value2;
7870
7894
return *result < value1;
7871
7895
#else
@@ -8008,7 +8032,7 @@ namespace arm64 {
8008
8032
namespace {
8009
8033
namespace simd {
8010
8034
8011
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
8035
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
8012
8036
namespace {
8013
8037
// Start of private section with Visual Studio workaround
8014
8038
@@ -8117,7 +8141,7 @@ namespace {
8117
8141
// We return uint32_t instead of uint16_t because that seems to be more efficient for most
8118
8142
// purposes (cutting it down to uint16_t costs performance in some compilers).
8119
8143
simdjson_inline uint32_t to_bitmask() const {
8120
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
8144
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
8121
8145
const uint8x16_t bit_mask = simdjson_make_uint8x16_t(0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80,
8122
8146
0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80);
8123
8147
#else
@@ -8148,7 +8172,7 @@ namespace {
8148
8172
// Splat constructor
8149
8173
simdjson_inline simd8(uint8_t _value) : simd8(splat(_value)) {}
8150
8174
// Member-by-member initialization
8151
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
8175
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
8152
8176
simdjson_inline simd8(
8153
8177
uint8_t v0, uint8_t v1, uint8_t v2, uint8_t v3, uint8_t v4, uint8_t v5, uint8_t v6, uint8_t v7,
8154
8178
uint8_t v8, uint8_t v9, uint8_t v10, uint8_t v11, uint8_t v12, uint8_t v13, uint8_t v14, uint8_t v15
@@ -8242,7 +8266,7 @@ namespace {
8242
8266
uint64x2_t shufmask64 = {thintable_epi8[mask1], thintable_epi8[mask2]};
8243
8267
uint8x16_t shufmask = vreinterpretq_u8_u64(shufmask64);
8244
8268
// we increment by 0x08 the second half of the mask
8245
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
8269
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
8246
8270
uint8x16_t inc = simdjson_make_uint8x16_t(0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08);
8247
8271
#else
8248
8272
uint8x16_t inc = {0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
@@ -8272,7 +8296,7 @@ namespace {
8272
8296
uint8x8_t compactmask1 = vcreate_u8(thintable_epi8[mask1]);
8273
8297
uint8x8_t compactmask2 = vcreate_u8(thintable_epi8[mask2]);
8274
8298
// we increment by 0x08 the second half of the mask
8275
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
8299
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
8276
8300
uint8x8_t inc = simdjson_make_uint8x8_t(0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08);
8277
8301
#else
8278
8302
uint8x8_t inc = {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
@@ -8324,7 +8348,7 @@ namespace {
8324
8348
// Array constructor
8325
8349
simdjson_inline simd8(const int8_t* values) : simd8(load(values)) {}
8326
8350
// Member-by-member initialization
8327
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
8351
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
8328
8352
simdjson_inline simd8(
8329
8353
int8_t v0, int8_t v1, int8_t v2, int8_t v3, int8_t v4, int8_t v5, int8_t v6, int8_t v7,
8330
8354
int8_t v8, int8_t v9, int8_t v10, int8_t v11, int8_t v12, int8_t v13, int8_t v14, int8_t v15
@@ -8445,7 +8469,7 @@ namespace {
8445
8469
}
8446
8470
8447
8471
simdjson_inline uint64_t to_bitmask() const {
8448
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
8472
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
8449
8473
const uint8x16_t bit_mask = simdjson_make_uint8x16_t(
8450
8474
0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80,
8451
8475
0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80
@@ -10555,7 +10579,7 @@ SIMDJSON_NO_SANITIZE_UNDEFINED
10555
10579
// See issue https://github.com/simdjson/simdjson/issues/1965
10556
10580
SIMDJSON_NO_SANITIZE_MEMORY
10557
10581
simdjson_inline int trailing_zeroes(uint64_t input_num) {
10558
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
10582
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
10559
10583
unsigned long ret;
10560
10584
// Search the mask data from least significant bit (LSB)
10561
10585
// to the most significant bit (MSB) for a set bit (1).
@@ -10579,7 +10603,7 @@ simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) {
10579
10603
SIMDJSON_NO_SANITIZE_UNDEFINED
10580
10604
/* result might be undefined when input_num is zero */
10581
10605
simdjson_inline int leading_zeroes(uint64_t input_num) {
10582
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
10606
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
10583
10607
unsigned long leading_zero = 0;
10584
10608
// Search the mask data from most significant bit (MSB)
10585
10609
// to least significant bit (LSB) for a set bit (1).
@@ -10632,7 +10656,7 @@ simdjson_inline uint64_t zero_leading_bit(uint64_t rev_bits, int leading_zeroes)
10632
10656
#endif
10633
10657
10634
10658
simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2, uint64_t *result) {
10635
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
10659
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
10636
10660
*result = value1 + value2;
10637
10661
return *result < value1;
10638
10662
#else
@@ -10775,7 +10799,7 @@ namespace arm64 {
10775
10799
namespace {
10776
10800
namespace simd {
10777
10801
10778
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
10802
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
10779
10803
namespace {
10780
10804
// Start of private section with Visual Studio workaround
10781
10805
@@ -10884,7 +10908,7 @@ namespace {
10884
10908
// We return uint32_t instead of uint16_t because that seems to be more efficient for most
10885
10909
// purposes (cutting it down to uint16_t costs performance in some compilers).
10886
10910
simdjson_inline uint32_t to_bitmask() const {
10887
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
10911
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
10888
10912
const uint8x16_t bit_mask = simdjson_make_uint8x16_t(0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80,
10889
10913
0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80);
10890
10914
#else
@@ -10915,7 +10939,7 @@ namespace {
10915
10939
// Splat constructor
10916
10940
simdjson_inline simd8(uint8_t _value) : simd8(splat(_value)) {}
10917
10941
// Member-by-member initialization
10918
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
10942
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
10919
10943
simdjson_inline simd8(
10920
10944
uint8_t v0, uint8_t v1, uint8_t v2, uint8_t v3, uint8_t v4, uint8_t v5, uint8_t v6, uint8_t v7,
10921
10945
uint8_t v8, uint8_t v9, uint8_t v10, uint8_t v11, uint8_t v12, uint8_t v13, uint8_t v14, uint8_t v15
@@ -11009,7 +11033,7 @@ namespace {
11009
11033
uint64x2_t shufmask64 = {thintable_epi8[mask1], thintable_epi8[mask2]};
11010
11034
uint8x16_t shufmask = vreinterpretq_u8_u64(shufmask64);
11011
11035
// we increment by 0x08 the second half of the mask
11012
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
11036
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
11013
11037
uint8x16_t inc = simdjson_make_uint8x16_t(0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08);
11014
11038
#else
11015
11039
uint8x16_t inc = {0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
@@ -11039,7 +11063,7 @@ namespace {
11039
11063
uint8x8_t compactmask1 = vcreate_u8(thintable_epi8[mask1]);
11040
11064
uint8x8_t compactmask2 = vcreate_u8(thintable_epi8[mask2]);
11041
11065
// we increment by 0x08 the second half of the mask
11042
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
11066
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
11043
11067
uint8x8_t inc = simdjson_make_uint8x8_t(0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08);
11044
11068
#else
11045
11069
uint8x8_t inc = {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
@@ -11091,7 +11115,7 @@ namespace {
11091
11115
// Array constructor
11092
11116
simdjson_inline simd8(const int8_t* values) : simd8(load(values)) {}
11093
11117
// Member-by-member initialization
11094
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
11118
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
11095
11119
simdjson_inline simd8(
11096
11120
int8_t v0, int8_t v1, int8_t v2, int8_t v3, int8_t v4, int8_t v5, int8_t v6, int8_t v7,
11097
11121
int8_t v8, int8_t v9, int8_t v10, int8_t v11, int8_t v12, int8_t v13, int8_t v14, int8_t v15
@@ -11212,7 +11236,7 @@ namespace {
11212
11236
}
11213
11237
11214
11238
simdjson_inline uint64_t to_bitmask() const {
11215
- #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
11239
+ #if SIMDJSON_REGULAR_VISUAL_STUDIO
11216
11240
const uint8x16_t bit_mask = simdjson_make_uint8x16_t(
11217
11241
0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80,
11218
11242
0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80
0 commit comments