using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

using b8 = bool;
using b32 = int32_t;
using b32x = int;

using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;

#define internal static

#define max(a, b) ((a) > (b)) ? (a) : (b)
#define min(a, b) ((a) < (b)) ? (a) : (b)

#define KiB(b) (b * 1024)
#define MiB(b) (KiB(b) * 1024)
#define GiB(b) (MiB(b) * 1024)

#define LIKELY(x) __builtin_expect(!!(x), 1)
#define UNLIKELY(x) __builtin_expect(!!(x), 0)

#ifdef R__BYTESWAP

#if defined(R__MACOSX)
#include <libkern/OSByteOrder.h>
u16 bswap(u16 x) { return _OSSwapInt16(x); }
u32 bswap(u32 x) { return _OSSwapInt32(x); }
u64 bswap(u64 x) { return _OSSwapInt64(x); }
#else
#include <byteswap.h>
u16 bswap(u16 x) { return bswap_16(x); }
u32 bswap(u32 x) { return bswap_32(x); }
u64 bswap(u64 x) { return bswap_64(x); }
#endif // defined(R__MACOSX)
#else
u16 bswap(u16 x) { return x; }
u32 bswap(u32 x) { return x; }
u64 bswap(u64 x) { return x; }
#endif