1 #ifndef LIBASSETMAP_MEMOPS_H
2 #define LIBASSETMAP_MEMOPS_H
8 using lam_size_t = LIBARCHIVEMAP_SIZE_TYPE;
21 constexpr
inline void PutValue(uint8_t* buf, T value) noexcept {
22 static_assert(std::is_same_v<uint8_t, unsigned char>);
23 static_assert(std::is_integral_v<T>,
"Only integral values permitted");
24 for (
auto i = 0; i <
sizeof(T); ++i)
25 buf[i] = (value >> (8 * i)) & 0xFF;
34 constexpr
inline T
GetValue(
const uint8_t* buf) noexcept {
35 static_assert(std::is_integral_v<T>,
"Only integral values permitted");
37 for (
auto i = 0; i <
sizeof(T); ++i)
38 ret |= buf[i] << (8 * i);
42 constexpr
auto PutLamSizeT = PutValue<lam_size_t>;
43 constexpr
auto GetLamSizeT = GetValue<lam_size_t>;
46 #endif // LIBASSETMAP_MEMOPS_H