Skip to content

Commit 98b387a

Browse files
authored
Fixing a messed up interleaved #ifdef/namespace. (simdjson#211)
1 parent 5312c7f commit 98b387a

6 files changed

Lines changed: 26 additions & 35 deletions

File tree

amalgamation.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ cat <<< '
101101
#include <iostream>
102102
#include "simdjson.h"
103103
#include "simdjson.cpp"
104-
using namespace simdjson;
105104
int main(int argc, char *argv[]) {
106105
const char * filename = argv[1];
107-
padded_string p = get_corpus(filename);
108-
ParsedJson pj = build_parsed_json(p); // do the parsing
106+
simdjson::padded_string p = simdjson::get_corpus(filename);
107+
simdjson::ParsedJson pj = simdjson::build_parsed_json(p); // do the parsing
109108
if( ! pj.isValid() ) {
110109
std::cout << "not valid" << std::endl;
111110
} else {

include/simdjson/jsonminifier.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include <cstddef>
55
#include <cstdint>
6+
#include <string_view>
7+
#include "simdjson/padded_string.h"
68

79
namespace simdjson {
810

include/simdjson/simdprune_tables.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "simdjson/portability.h"
66

77

8-
namespace simdjson {
98
#ifdef __AVX__
9+
namespace simdjson {
1010
static const unsigned char mask128_epi8[] = {
1111
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe,
1212
0xf, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe,
@@ -34990,7 +34990,6 @@ static const unsigned char mask128_epi32[] = {
3499034990
#endif //__SSE3__
3499134991

3499234992
#ifdef __AVX2__
34993-
3499434993
namespace simdjson {
3499534994
static const uint32_t mask256_epi32[] = {
3499634995
0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 7, 0, 2, 3, 4, 5, 6, 7, 7, 2,

include/simdjson/simdutf8check_neon.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
#ifndef SIMDJSON_SIMDUTF8CHECK_NEON_H
55
#define SIMDJSON_SIMDUTF8CHECK_NEON_H
66

7-
#if defined(__aarch64__) || (defined(_MSC_VER) && defined(_M_ARM64))
7+
#if defined(_ARM_NEON) || defined(__aarch64__) || (defined(_MSC_VER) && defined(_M_ARM64))
88

9-
#include <stdio.h>
10-
#include <stddef.h>
11-
#include <stdint.h>
12-
#include <string.h>
13-
#include <inttypes.h>
9+
#include <cstdio>
10+
#include <cstddef>
11+
#include <cstdint>
12+
#include <cstring>
13+
#include <cinttypes>
1414
#include <arm_neon.h>
1515

1616
/*

singleheader/amalgamation_demo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
/* auto-generated on Tue 9 Jul 2019 16:53:17 EDT. Do not edit! */
1+
/* auto-generated on Tue Jul 9 19:40:16 EDT 2019. Do not edit! */
22

33
#include <iostream>
44
#include "simdjson.h"
55
#include "simdjson.cpp"
6-
using namespace simdjson;
76
int main(int argc, char *argv[]) {
87
const char * filename = argv[1];
9-
padded_string p = get_corpus(filename);
10-
ParsedJson pj = build_parsed_json(p); // do the parsing
8+
simdjson::padded_string p = simdjson::get_corpus(filename);
9+
simdjson::ParsedJson pj = simdjson::build_parsed_json(p); // do the parsing
1110
if( ! pj.isValid() ) {
1211
std::cout << "not valid" << std::endl;
1312
} else {

singleheader/simdjson.h

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on Tue 9 Jul 2019 16:53:17 EDT. Do not edit! */
1+
/* auto-generated on Tue Jul 9 19:40:16 EDT 2019. Do not edit! */
22
/* begin file include/simdjson/simdjson_version.h */
33
// /include/simdjson/simdjson_version.h automatically generated by release.py, do not change by hand
44
#ifndef SIMDJSON_INCLUDE_SIMDJSON_VERSION
@@ -100,7 +100,7 @@ static inline int hamming(uint64_t input_num) {
100100
__popcnt((uint32_t)(input_num >> 32)));
101101
#endif
102102
}
103-
}
103+
} // namespace simdjson
104104
#else
105105
#include <cstdint>
106106
#include <cstdlib>
@@ -917,11 +917,12 @@ padded_string get_corpus(const std::string& filename);
917917
/* begin file include/simdjson/simdprune_tables.h */
918918
#ifndef SIMDJSON_SIMDPRUNE_TABLES_H
919919
#define SIMDJSON_SIMDPRUNE_TABLES_H
920+
#include <cstdint>
920921

921922

922923

923-
namespace simdjson {
924924
#ifdef __AVX__
925+
namespace simdjson {
925926
static const unsigned char mask128_epi8[] = {
926927
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe,
927928
0xf, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe,
@@ -35901,12 +35902,10 @@ static const unsigned char mask128_epi32[] = {
3590135902
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
3590235903
0xff, 0xff, 0xff, 0xff,
3590335904
};
35904-
}
35905+
} // namespace simdjson
3590535906
#endif //__SSE3__
3590635907

3590735908
#ifdef __AVX2__
35908-
35909-
#include <cstdint>
3591035909
namespace simdjson {
3591135910
static const uint32_t mask256_epi32[] = {
3591235911
0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 7, 0, 2, 3, 4, 5, 6, 7, 7, 2,
@@ -36335,13 +36334,13 @@ avxcheckUTF8Bytes(__m256i current_bytes,
3633536334
#ifndef SIMDJSON_SIMDUTF8CHECK_NEON_H
3633636335
#define SIMDJSON_SIMDUTF8CHECK_NEON_H
3633736336

36338-
#if defined(__aarch64__) || (defined(_MSC_VER) && defined(_M_ARM64))
36337+
#if defined(_ARM_NEON) || defined(__aarch64__) || (defined(_MSC_VER) && defined(_M_ARM64))
3633936338

36340-
#include <stdio.h>
36341-
#include <stddef.h>
36342-
#include <stdint.h>
36343-
#include <string.h>
36344-
#include <inttypes.h>
36339+
#include <cstdio>
36340+
#include <cstddef>
36341+
#include <cstdint>
36342+
#include <cstring>
36343+
#include <cinttypes>
3634536344
#include <arm_neon.h>
3634636345

3634736346
/*
@@ -36508,6 +36507,7 @@ checkUTF8Bytes(int8x16_t current_bytes, struct processed_utf_bytes *previous,
3650836507

3650936508
#include <cstddef>
3651036509
#include <cstdint>
36510+
#include <string_view>
3651136511

3651236512
namespace simdjson {
3651336513

@@ -37137,18 +37137,10 @@ uint64_t neonmovemask_bulk(uint8x16_t p0, uint8x16_t p1, uint8x16_t p2, uint8x16
3713737137
0x04, 0x40, 0x04, 0x40, 0x04, 0x40, 0x04, 0x40};
3713837138
const uint8x16_t bitmask4 = { 0x08, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08, 0x80,
3713937139
0x08, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08, 0x80};
37140-
#if 0
37141-
uint8x16_t t0 = vandq_u8(p0, bitmask1);
37142-
uint8x16_t t1 = vandq_u8(p1, bitmask2);
37143-
uint8x16_t t2 = vandq_u8(p2, bitmask3);
37144-
uint8x16_t t3 = vandq_u8(p3, bitmask4);
37145-
uint8x16_t tmp = vorrq_u8(vorrq_u8(t0, t1), vorrq_u8(t2, t3));
37146-
#else
3714737140
uint8x16_t t0 = vandq_u8(p0, bitmask1);
3714837141
uint8x16_t t1 = vbslq_u8(bitmask2, p1, t0);
3714937142
uint8x16_t t2 = vbslq_u8(bitmask3, p2, t1);
3715037143
uint8x16_t tmp = vbslq_u8(bitmask4, p3, t2);
37151-
#endif
3715237144
uint8x16_t sum = vpaddq_u8(tmp, tmp);
3715337145
return vgetq_lane_u64(vreinterpretq_u64_u8(sum), 0);
3715437146
#endif

0 commit comments

Comments
 (0)