diff options
Diffstat (limited to 'llama.cpp/src/llama-io.cpp')
| -rw-r--r-- | llama.cpp/src/llama-io.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llama.cpp/src/llama-io.cpp b/llama.cpp/src/llama-io.cpp new file mode 100644 index 0000000..7ad70d1 --- /dev/null +++ b/llama.cpp/src/llama-io.cpp @@ -0,0 +1,15 @@ +#include "llama-io.h" + +void llama_io_write_i::write_string(const std::string & str) { + uint32_t str_size = str.size(); + + write(&str_size, sizeof(str_size)); + write(str.data(), str_size); +} + +void llama_io_read_i::read_string(std::string & str) { + uint32_t str_size; + read_to(&str_size, sizeof(str_size)); + + str.assign((const char *) read(str_size), str_size); +} |
