diff options
| author | Stefan Boberg <[email protected]> | 2021-08-18 13:03:06 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-08-18 13:03:06 +0200 |
| commit | f8dd6c3c6b8abeb12fb8dffd91ebe39e562875ee (patch) | |
| tree | 236a8bbf58b3352d65fbab9246786a592a3047b8 | |
| parent | Removed accidental check-in (diff) | |
| download | zen-f8dd6c3c6b8abeb12fb8dffd91ebe39e562875ee.tar.xz zen-f8dd6c3c6b8abeb12fb8dffd91ebe39e562875ee.zip | |
Added ToNetworkOrder() functions
| -rw-r--r-- | zencore/include/zencore/endian.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/zencore/include/zencore/endian.h b/zencore/include/zencore/endian.h index 27c831bb1..1f79a59e8 100644 --- a/zencore/include/zencore/endian.h +++ b/zencore/include/zencore/endian.h @@ -58,4 +58,40 @@ FromNetworkOrder(int64_t x) return ByteSwap(uint64_t(x)); } +inline uint16_t +ToNetworkOrder(uint16_t x) +{ + return ByteSwap(x); +} + +inline uint32_t +ToNetworkOrder(uint32_t x) +{ + return ByteSwap(x); +} + +inline uint64_t +ToNetworkOrder(uint64_t x) +{ + return ByteSwap(x); +} + +inline uint16_t +ToNetworkOrder(int16_t x) +{ + return ByteSwap(uint16_t(x)); +} + +inline uint32_t +ToNetworkOrder(int32_t x) +{ + return ByteSwap(uint32_t(x)); +} + +inline uint64_t +ToNetworkOrder(int64_t x) +{ + return ByteSwap(uint64_t(x)); +} + } // namespace zen |