mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
improved string padded (#440)
* dirent portable latest version * improved std::string argument passed by const reference ctor added with std::string_view argument `allocate_padded_buffer()` moved here with **optional** check on `length < 1` * allocate_padded_buffer moved to padded_string.h
This commit is contained in:
@@ -4,15 +4,6 @@
|
||||
#include <climits>
|
||||
|
||||
namespace simdjson {
|
||||
char *allocate_padded_buffer(size_t length) {
|
||||
// we could do a simple malloc
|
||||
// return (char *) malloc(length + SIMDJSON_PADDING);
|
||||
// However, we might as well align to cache lines...
|
||||
size_t totalpaddedlength = length + SIMDJSON_PADDING;
|
||||
char *padded_buffer = aligned_malloc_char(64, totalpaddedlength);
|
||||
memset(padded_buffer + length, 0, totalpaddedlength - length);
|
||||
return padded_buffer;
|
||||
}
|
||||
|
||||
padded_string get_corpus(const std::string &filename) {
|
||||
std::FILE *fp = std::fopen(filename.c_str(), "rb");
|
||||
|
||||
Reference in New Issue
Block a user