diff options
author | 2016-08-16 17:53:22 +1000 | |
---|---|---|
committer | 2016-08-16 17:53:22 +1000 | |
commit | 9121d7434434e423c84198e3f49d7bade238fefd (patch) | |
tree | 5b416522390abb5891c094f5ccdfb3884ecd0fda | |
parent | 222d054bdc770038a22f389cd493c43dc05e0ec4 (diff) |
check number of bits in BITSWAPnn and expand up to 64
-rw-r--r-- | src/emu/emucore.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/emu/emucore.h b/src/emu/emucore.h index c9b7900b010..c5d618d4355 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -27,6 +27,7 @@ #endif // standard C++ includes +#include <cassert> #include <exception> #include <type_traits> #include <typeinfo> @@ -254,10 +255,14 @@ template <typename T, typename U, typename... V> constexpr T bitswap(T val, U b, } // legacy names for backwards compatibility -template <typename T, typename... U> constexpr T BITSWAP8(T val, U... b) { return bitswap(val, b...); } -template <typename T, typename... U> constexpr T BITSWAP16(T val, U... b) { return bitswap(val, b...); } -template <typename T, typename... U> constexpr T BITSWAP24(T val, U... b) { return bitswap(val, b...); } -template <typename T, typename... U> constexpr T BITSWAP32(T val, U... b) { return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP8(T val, U... b) { static_assert(sizeof...(b) == 8U, "wrong number of bits"); return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP16(T val, U... b) { static_assert(sizeof...(b) == 16U, "wrong number of bits"); return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP24(T val, U... b) { static_assert(sizeof...(b) == 24U, "wrong number of bits"); return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP32(T val, U... b) { static_assert(sizeof...(b) == 32U, "wrong number of bits"); return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP40(T val, U... b) { static_assert(sizeof...(b) == 40U, "wrong number of bits"); return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP48(T val, U... b) { static_assert(sizeof...(b) == 48U, "wrong number of bits"); return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP56(T val, U... b) { static_assert(sizeof...(b) == 56U, "wrong number of bits"); return bitswap(val, b...); } +template <typename T, typename... U> constexpr T BITSWAP64(T val, U... b) { static_assert(sizeof...(b) == 64U, "wrong number of bits"); return bitswap(val, b...); } |