mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Hiding the pointer away... (#252)
* Hiding the runtime dispatch pointer in a source file so it is not an exported symbol * Disabling hard failure on style check. * Fixes https://github.com/lemire/simdjson/issues/250
This commit is contained in:
@@ -5,6 +5,29 @@
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
// The function that users are expected to call is json_parse.
|
||||
// We have more than one such function because we want to support several
|
||||
// instruction sets.
|
||||
|
||||
// function pointer type for json_parse
|
||||
using json_parse_functype = int(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
bool realloc_if_needed);
|
||||
|
||||
// Pointer that holds the json_parse implementation corresponding to the
|
||||
// available SIMD instruction set
|
||||
extern json_parse_functype *json_parse_ptr;
|
||||
|
||||
int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
bool realloc_if_needed) {
|
||||
return json_parse_ptr(buf, len, pj, realloc_if_needed);
|
||||
}
|
||||
|
||||
int json_parse(const char *buf, size_t len, ParsedJson &pj,
|
||||
bool realloc_if_needed) {
|
||||
return json_parse_ptr(reinterpret_cast<const uint8_t *>(buf), len, pj,
|
||||
realloc_if_needed);
|
||||
}
|
||||
|
||||
Architecture find_best_supported_implementation() {
|
||||
constexpr uint32_t haswell_flags =
|
||||
instruction_set::AVX2 | instruction_set::PCLMULQDQ |
|
||||
|
||||
Reference in New Issue
Block a user