diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-22 13:00:06 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-22 13:00:06 +0100 |
commit | 1fae63de23320a1663b7c591e247ad81852ab6dc (patch) | |
tree | bfe539b7eeb5a4d7b68aa1bf853898d60e34f784 /byteorder.h | |
parent | 739297d8895b08a9ecd8e81b01b7ba8e8dc4a8ae (diff) |
Support 16-bit short
Diffstat (limited to 'byteorder.h')
-rw-r--r-- | byteorder.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/byteorder.h b/byteorder.h new file mode 100644 index 0000000..56555b7 --- /dev/null +++ b/byteorder.h @@ -0,0 +1,17 @@ +#pragma once + +#include <cstdint> +#include <vector> + +namespace endian { + + std::vector<uint8_t> to_little(uint16_t value); + uint16_t from_little16(const std::vector<uint8_t>& value); + + std::vector<uint8_t> to_little(uint32_t value); + uint32_t from_little32(const std::vector<uint8_t>& value); + + std::vector<uint8_t> to_little(uint64_t value); + uint64_t from_little64(const std::vector<uint8_t>& value); + +} |