18#if __has_include(<endian.h>)
21#include <android-base/endian.h>
32#define DECLARE_TYPE(new_type, base_type, to_new, to_base) \
35 new_type() = default; \
36 explicit new_type(base_type val) : inner_(to_new(val)) {} \
37 new_type(const new_type&) = default; \
38 new_type& operator=(const new_type& other) = default; \
39 volatile new_type& operator=(const new_type& other) volatile { \
40 inner_ = other.inner_; \
43 base_type as_##base_type() const volatile { return to_base(inner_); } \
48 static_assert(sizeof(new_type) == sizeof(base_type))
Definition: alloc_driver.h:21
DECLARE_TYPE(Le16, uint16_t, htole16, le16toh)