| 1 |
/* SPDX-License-Identifier: BSD-3-Clause */ |
| 2 |
/* SPDX-FileCopyrightText: OpenMPT Project Developers and Contributors */ |
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include "openmpt/all/BuildSettings.hpp" |
| 8 |
|
| 9 |
#include "mpt/base/bit.hpp" |
| 10 |
#include "mpt/base/memory.hpp" |
| 11 |
#include "mpt/endian/floatingpoint.hpp" |
| 12 |
#include "mpt/endian/integer.hpp" |
| 13 |
#include "mpt/endian/type_traits.hpp" |
| 14 |
#include "openmpt/base/Types.hpp" |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
OPENMPT_NAMESPACE_BEGIN |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
using int64le = mpt::packed<int64, mpt::endian::little>; |
| 23 |
using int32le = mpt::packed<int32, mpt::endian::little>; |
| 24 |
using int16le = mpt::packed<int16, mpt::endian::little>; |
| 25 |
using int8le = mpt::packed<int8, mpt::endian::little>; |
| 26 |
using uint64le = mpt::packed<uint64, mpt::endian::little>; |
| 27 |
using uint32le = mpt::packed<uint32, mpt::endian::little>; |
| 28 |
using uint16le = mpt::packed<uint16, mpt::endian::little>; |
| 29 |
using uint8le = mpt::packed<uint8, mpt::endian::little>; |
| 30 |
|
| 31 |
using int64be = mpt::packed<int64, mpt::endian::big>; |
| 32 |
using int32be = mpt::packed<int32, mpt::endian::big>; |
| 33 |
using int16be = mpt::packed<int16, mpt::endian::big>; |
| 34 |
using int8be = mpt::packed<int8, mpt::endian::big>; |
| 35 |
using uint64be = mpt::packed<uint64, mpt::endian::big>; |
| 36 |
using uint32be = mpt::packed<uint32, mpt::endian::big>; |
| 37 |
using uint16be = mpt::packed<uint16, mpt::endian::big>; |
| 38 |
using uint8be = mpt::packed<uint8, mpt::endian::big>; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
using IEEE754binary32LE = mpt::IEEE754binary_types<mpt::float_traits<somefloat32>::is_float32 && mpt::float_traits<somefloat32>::is_ieee754_binary && mpt::float_traits<somefloat32>::is_native_endian, mpt::endian::native>::IEEE754binary32LE; |
| 43 |
using IEEE754binary32BE = mpt::IEEE754binary_types<mpt::float_traits<somefloat32>::is_float32 && mpt::float_traits<somefloat32>::is_ieee754_binary && mpt::float_traits<somefloat32>::is_native_endian, mpt::endian::native>::IEEE754binary32BE; |
| 44 |
using IEEE754binary64LE = mpt::IEEE754binary_types<mpt::float_traits<somefloat64>::is_float64 && mpt::float_traits<somefloat64>::is_ieee754_binary && mpt::float_traits<somefloat64>::is_native_endian, mpt::endian::native>::IEEE754binary64LE; |
| 45 |
using IEEE754binary64BE = mpt::IEEE754binary_types<mpt::float_traits<somefloat64>::is_float64 && mpt::float_traits<somefloat64>::is_ieee754_binary && mpt::float_traits<somefloat64>::is_native_endian, mpt::endian::native>::IEEE754binary64BE; |
| 46 |
|
| 47 |
|
| 48 |
// unaligned |
| 49 |
|
| 50 |
using float32le = mpt::IEEE754binary32EmulatedLE; |
| 51 |
using float32be = mpt::IEEE754binary32EmulatedBE; |
| 52 |
using float64le = mpt::IEEE754binary64EmulatedLE; |
| 53 |
using float64be = mpt::IEEE754binary64EmulatedBE; |
| 54 |
|
| 55 |
|
| 56 |
// potentially aligned |
| 57 |
|
| 58 |
using float32le_fast = mpt::IEEE754binary32LE; |
| 59 |
using float32be_fast = mpt::IEEE754binary32BE; |
| 60 |
using float64le_fast = mpt::IEEE754binary64LE; |
| 61 |
using float64be_fast = mpt::IEEE754binary64BE; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
#define MPT_BINARY_STRUCT(type, size) \ |
| 66 |
constexpr bool declare_binary_safe(const type &) \ |
| 67 |
{ \ |
| 68 |
return true; \ |
| 69 |
} \ |
| 70 |
static_assert(mpt::check_binary_size<type>(size)); \ |
| 71 |
/**/ |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
OPENMPT_NAMESPACE_END |