diff options
Diffstat (limited to 'src/blu_cat/com')
| -rw-r--r-- | src/blu_cat/com/binary_reader.cpp | 8 | ||||
| -rw-r--r-- | src/blu_cat/com/binary_reader.hpp | 3 | ||||
| -rw-r--r-- | src/blu_cat/com/binary_writer.cpp | 4 | ||||
| -rw-r--r-- | src/blu_cat/com/numbers.hpp | 1 |
4 files changed, 14 insertions, 2 deletions
diff --git a/src/blu_cat/com/binary_reader.cpp b/src/blu_cat/com/binary_reader.cpp index bb4d231..d572ec9 100644 --- a/src/blu_cat/com/binary_reader.cpp +++ b/src/blu_cat/com/binary_reader.cpp @@ -68,6 +68,14 @@ BinaryReader::read_ui8() } UI32 +BinaryReader::read_ui16() +{ + UI8 b1{this->data[_pointer++]}, b2{this->data[_pointer++]}; + + return b1 << 8 | b2; +} + +UI32 BinaryReader::read_ui32() { UI8 b1{this->data[_pointer++]}, b2{this->data[_pointer++]}, diff --git a/src/blu_cat/com/binary_reader.hpp b/src/blu_cat/com/binary_reader.hpp index fec88b6..7b7309c 100644 --- a/src/blu_cat/com/binary_reader.hpp +++ b/src/blu_cat/com/binary_reader.hpp @@ -43,6 +43,9 @@ public: read_ui8(); UI32 + read_ui16(); + + UI32 read_ui32(); UI64 diff --git a/src/blu_cat/com/binary_writer.cpp b/src/blu_cat/com/binary_writer.cpp index 7af3b6d..fe06195 100644 --- a/src/blu_cat/com/binary_writer.cpp +++ b/src/blu_cat/com/binary_writer.cpp @@ -32,12 +32,12 @@ union IntAndFloat64bit{ } BinaryWriter::BinaryWriter(const char *file_path): - output{file_path, std::ios::binary} + output{file_path, std::ios::binary} { } BinaryWriter::BinaryWriter(const std::string &file_path): - BinaryWriter{file_path.c_str()} + BinaryWriter{file_path.c_str()} { } diff --git a/src/blu_cat/com/numbers.hpp b/src/blu_cat/com/numbers.hpp index 1fd3400..6f0ca47 100644 --- a/src/blu_cat/com/numbers.hpp +++ b/src/blu_cat/com/numbers.hpp @@ -60,6 +60,7 @@ typedef uint_fast64_t UI64F; typedef std::float32_t F32; typedef std::float64_t F64; +constexpr UI32F SIZE_16_BIT{2}; constexpr UI32F SIZE_32_BIT{4}; constexpr UI32F SIZE_64_BIT{8}; |
