bsnes-libretro/nall/inline-if.hpp
Tim Allen 53843934c0 Update to v106r84 release.
byuu says:

Changelog:

  - fixed a few TLCS900H CPU and disassembler bugs
  - hooked up a basic Neo Geo Pocket emulator skeleton and memory map;
    can run a few instructions from the BIOS
  - emulated the flash memory used by Neo Geo Pocket games
  - added sourcery to the higan source archives
  - fixed ternary expressions in sfc/ppu-fast [hex_usr]
2019-01-21 16:27:24 +11:00

12 lines
567 B
C++

#pragma once
#warning "these defines break if statements with multiple parameters to templates"
#define if1(statement) if(statement)
#define if2(condition, false) ([&](auto&& value) -> decltype(condition) { \
return (bool)value ? value : (decltype(condition))false; \
})(condition)
#define if3(condition, true, false) ((condition) ? (true) : (decltype(true))(false))
#define if4(type, condition, true, false) ((condition) ? (type)(true) : (type)(false))
#define if_(_1, _2, _3, _4, name, ...) name
#define if(...) if_(__VA_ARGS__, if4, if3, if2, if1)(__VA_ARGS__)