Download cpp_engine/src/protocol/binary_protocol.cpp from Ypeng12/quant-ai: direct link, hf CLI and curl.
- Browser
- Download file 469 Bytes
-
https://huggingface.co/spaces/Ypeng12/quant-ai/resolve/main/cpp_engine/src/protocol/binary_protocol.cpp
- Command line
-
hf download hf://spaces/Ypeng12/quant-ai/cpp_engine/src/protocol/binary_protocol.cpp
-
curl -L -o binary_protocol.cpp https://huggingface.co/spaces/Ypeng12/quant-ai/resolve/main/cpp_engine/src/protocol/binary_protocol.cpp
469 Bytes
| namespace quant::protocol { | |
| std::optional<FrameHeader> BinaryProtocol::parse_header(std::span<const uint8_t> buffer) noexcept { | |
| if (buffer.size() < sizeof(FrameHeader)) { | |
| return std::nullopt; | |
| } | |
| const auto* hdr = reinterpret_cast<const FrameHeader*>(buffer.data()); | |
| if (hdr->magic != PROTOCOL_MAGIC) { | |
| return std::nullopt; | |
| } | |
| return *hdr; | |
| } | |
| } // namespace quant::protocol | |