Files
magenta/include/socks/compiler.h
T

34 lines
605 B
C++
Raw Normal View History

#ifndef SOCKS_COMPILER_H_
#define SOCKS_COMPILER_H_
#define READ_ONCE(t, p) (*((const volatile t *)&(p)))
#define WRITE_ONCE(t, p, v) *(volatile t *)&(p) = (v)
2023-03-19 20:36:13 +00:00
#ifdef __cplusplus
template <typename T>
T read_once(const volatile T *ptr)
{
return *ptr;
}
template <typename T>
void write_once(volatile T *ptr, T value)
{
*ptr = value;
}
#endif
2023-02-25 17:57:53 +00:00
#undef __used
#define __used __attribute__((used))
2023-02-25 17:57:53 +00:00
#undef __packed
2022-12-24 10:28:41 +00:00
#define __packed __attribute__((packed))
2023-02-25 17:57:53 +00:00
#undef __section
#define __section(name) __attribute__((section(name)))
2023-02-25 17:57:53 +00:00
#undef __aligned
2023-02-04 17:46:05 +00:00
#define __aligned(x) __attribute__((aligned(x)))
#endif