mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
c2eea8abba
* massive clang-format -style=LLVM * naming harmonization * adding commentary about sysinfoapi.h
31 lines
993 B
C++
31 lines
993 B
C++
#ifndef SIMDJSON_JSONMINIFIER_H
|
|
#define SIMDJSON_JSONMINIFIER_H
|
|
|
|
#include "simdjson/padded_string.h"
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string_view>
|
|
|
|
namespace simdjson {
|
|
|
|
// Take input from buf and remove useless whitespace, write it to out; buf and
|
|
// out can be the same pointer. Result is null terminated,
|
|
// return the string length (minus the null termination).
|
|
// The accelerated version of this function only runs on AVX2 hardware.
|
|
size_t json_minify(const uint8_t *buf, size_t len, uint8_t *out);
|
|
|
|
static inline size_t json_minify(const char *buf, size_t len, char *out) {
|
|
return json_minify(reinterpret_cast<const uint8_t *>(buf), len,
|
|
reinterpret_cast<uint8_t *>(out));
|
|
}
|
|
|
|
static inline size_t json_minify(const std::string_view &p, char *out) {
|
|
return json_minify(p.data(), p.size(), out);
|
|
}
|
|
|
|
static inline size_t json_minify(const padded_string &p, char *out) {
|
|
return json_minify(p.data(), p.size(), out);
|
|
}
|
|
} // namespace simdjson
|
|
#endif
|