TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
flags.h
1 /*
2  * Copyright (c) 2017-present, Facebook, Inc.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #pragma once
9 
10 #define DEFINE_FLAG_OPERATORS(Type) \
11  inline Type operator|(Type a, Type b) { \
12  return static_cast<Type>( \
13  static_cast<std::underlying_type_t<Type>>(a) | \
14  static_cast<std::underlying_type_t<Type>>(b)); \
15  } \
16  inline Type operator&(Type a, Type b) { \
17  return static_cast<Type>( \
18  static_cast<std::underlying_type_t<Type>>(a) & \
19  static_cast<std::underlying_type_t<Type>>(b)); \
20  } \
21  inline Type operator~(Type a) { \
22  return static_cast<Type>(~static_cast<std::underlying_type_t<Type>>(a)); \
23  }