| 13 | namespace MLLM_ANONYMOUS_NAMESPACE { |
| 14 | |
| 15 | inline void write_be64(unsigned char* dst, uint64_t v) { |
| 16 | if constexpr (std::endian::native == std::endian::little) v = __builtin_bswap64(v); // GCC/Clang can use this extention. |
| 17 | std::memcpy(dst, &v, sizeof(v)); |
| 18 | } |
| 19 | |
| 20 | inline void write_be32(unsigned char* dst, uint32_t v) { |
| 21 | if constexpr (std::endian::native == std::endian::little) v = __builtin_bswap32(v); |