wut  v1.7.0
Wii U Toolchain
wut_types.h
Go to the documentation of this file.
1 #pragma once
2 #include <stdint.h>
3 #include <stdbool.h>
4 #include <stddef.h>
5 #include <stdalign.h>
6 
7 typedef int32_t BOOL;
8 
9 #ifndef TRUE
10 #define TRUE 1
11 #endif
12 
13 #ifndef FALSE
14 #define FALSE 0
15 #endif
16 
17 #if defined(__cplusplus) && (__cplusplus >= 201402L)
18 #include <type_traits>
19 
20 #define WUT_ENUM_BITMASK_TYPE(_type) \
21  extern "C++" { namespace { \
22  constexpr inline _type operator~(_type lhs) { \
23  return static_cast<_type>(~static_cast<std::underlying_type_t<_type>>(lhs)); \
24  } \
25  constexpr inline _type operator&(_type lhs, _type rhs) { \
26  return static_cast<_type>(static_cast<std::underlying_type_t<_type>>(lhs) & static_cast<std::underlying_type_t<_type>>(rhs)); \
27  } \
28  constexpr inline _type operator|(_type lhs, _type rhs) { \
29  return static_cast<_type>(static_cast<std::underlying_type_t<_type>>(lhs) | static_cast<std::underlying_type_t<_type>>(rhs)); \
30  } \
31  constexpr inline _type operator^(_type lhs, _type rhs) { \
32  return static_cast<_type>(static_cast<std::underlying_type_t<_type>>(lhs) ^ static_cast<std::underlying_type_t<_type>>(rhs)); \
33  } \
34  inline _type& operator&=(_type &lhs, _type rhs) { \
35  return reinterpret_cast<_type&>(reinterpret_cast<std::underlying_type_t<_type>&>(lhs) &= static_cast<std::underlying_type_t<_type>>(rhs)); \
36  } \
37  inline _type& operator|=(_type &lhs, _type rhs) { \
38  return reinterpret_cast<_type&>(reinterpret_cast<std::underlying_type_t<_type>&>(lhs) |= static_cast<std::underlying_type_t<_type>>(rhs)); \
39  } \
40  inline _type& operator^=(_type &lhs, _type rhs) { \
41  return reinterpret_cast<_type&>(reinterpret_cast<std::underlying_type_t<_type>&>(lhs) ^= static_cast<std::underlying_type_t<_type>>(rhs)); \
42  } \
43  } }
44 #else
45 #define WUT_ENUM_BITMASK_TYPE(_type)
46 #endif
int32_t BOOL
Definition: wut_types.h:7