29#define DECLARE_TYPE(new_type, base_type, to_new, to_base) \
32 new_type() = default; \
33 explicit new_type(base_type val) : inner_(to_new(val)) {} \
34 new_type(const new_type&) = default; \
35 new_type& operator=(const new_type& other) = default; \
36 volatile new_type& operator=(const new_type& other) volatile { \
37 inner_ = other.inner_; \
40 base_type as_##base_type() const volatile { return to_base(inner_); } \
45 static_assert(sizeof(new_type) == sizeof(base_type))
#define htole64(x)
Definition: endian.h:86
#define htole16(x)
Definition: endian.h:84
#define htobe16(x)
Definition: endian.h:76
#define htobe64(x)
Definition: endian.h:78
#define le16toh(x)
Definition: endian.h:96
#define be32toh(x)
Definition: endian.h:93
#define htole32(x)
Definition: endian.h:85
#define htobe32(x)
Definition: endian.h:77
#define be16toh(x)
Definition: endian.h:92
#define le32toh(x)
Definition: endian.h:97
#define be64toh(x)
Definition: endian.h:94
#define le64toh(x)
Definition: endian.h:98
Definition: alloc_utils.cpp:23
DECLARE_TYPE(Le16, uint16_t, htole16, le16toh)