srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/include/wireframe/byteio.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/wireframe/byteio.hpp')
-rw-r--r--include/wireframe/byteio.hpp22
1 files changed, 0 insertions, 22 deletions
diff --git a/include/wireframe/byteio.hpp b/include/wireframe/byteio.hpp
deleted file mode 100644
index c37c29e..0000000
--- a/include/wireframe/byteio.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include <cstdint>
-#include <span>
-
-// Manual big-endian reads instead of reinterpret_cast onto a packed
-// struct: network buffers from pcap aren't guaranteed aligned for
-// multi-byte integer types, so casting would be undefined behavior.
-namespace wireframe {
-
-inline std::uint16_t read_be16(std::span<const unsigned char> bytes, std::size_t offset) {
- return static_cast<std::uint16_t>((bytes[offset] << 8) | bytes[offset + 1]);
-}
-
-inline std::uint32_t read_be32(std::span<const unsigned char> bytes, std::size_t offset) {
- return (static_cast<std::uint32_t>(bytes[offset]) << 24) |
- (static_cast<std::uint32_t>(bytes[offset + 1]) << 16) |
- (static_cast<std::uint32_t>(bytes[offset + 2]) << 8) |
- static_cast<std::uint32_t>(bytes[offset + 3]);
-}
-
-} // namespace wireframe