-// Macros for automatically choosing the appropriate memory size
-// access method.
-extern void __force_link_error__unknown_type();
-
-#define __GET_VAR(seg, var) ({ \
- typeof(var) __val; \
- if (__builtin_types_compatible_p(typeof(__val), u8) \
- || __builtin_types_compatible_p(typeof(__val), s8)) \
- __val = READ8_SEG(seg, var); \
- else if (__builtin_types_compatible_p(typeof(__val), u16) \
- || __builtin_types_compatible_p(typeof(__val), s16)) \
- __val = READ16_SEG(seg, var); \
- else if (__builtin_types_compatible_p(typeof(__val), u32) \
- || __builtin_types_compatible_p(typeof(__val), s32)) \
- __val = READ32_SEG(seg, var); \
- else if (__builtin_types_compatible_p(typeof(__val), u64) \
- || __builtin_types_compatible_p(typeof(__val), s64)) \
- __val = READ64_SEG(seg, var); \
- else \
- __force_link_error__unknown_type(); \
- __val; })
-
-#define __SET_VAR(seg, var, val) do { \
- if (__builtin_types_compatible_p(typeof(var), u8) \
- || __builtin_types_compatible_p(typeof(var), s8)) \
- WRITE8_SEG(seg, var, (val)); \
- else if (__builtin_types_compatible_p(typeof(var), u16) \
- || __builtin_types_compatible_p(typeof(var), s16)) \
- WRITE16_SEG(seg, var, (val)); \
- else if (__builtin_types_compatible_p(typeof(var), u32) \
- || __builtin_types_compatible_p(typeof(var), s32)) \
- WRITE32_SEG(seg, var, (val)); \
- else if (__builtin_types_compatible_p(typeof(var), u64) \
- || __builtin_types_compatible_p(typeof(var), s64)) \
- WRITE64_SEG(seg, var, (val)); \
- else \
- __force_link_error__unknown_type(); \
- } while (0)
-