forked from boostorg/endian
Add floating point typedefs to arithmetic.hpp; rename double64 to float64 in buffers.hpp
This commit is contained in:
@ -97,6 +97,12 @@ namespace endian
|
||||
typedef endian_arithmetic<order::little, uint32_t, 32, align::yes> little_uint32_at;
|
||||
typedef endian_arithmetic<order::little, uint64_t, 64, align::yes> little_uint64_at;
|
||||
|
||||
// aligned floating point types
|
||||
typedef endian_arithmetic<order::big, float, 32, align::yes> big_float32_at;
|
||||
typedef endian_arithmetic<order::big, double, 64, align::yes> big_float64_at;
|
||||
typedef endian_arithmetic<order::little, float, 32, align::yes> little_float32_at;
|
||||
typedef endian_arithmetic<order::little, double, 64, align::yes> little_float64_at;
|
||||
|
||||
// aligned native endian typedefs are not provided because
|
||||
// <cstdint> types are superior for this use case
|
||||
|
||||
@ -182,6 +188,14 @@ namespace endian
|
||||
typedef little_uint64_t native_uint64_t;
|
||||
# endif
|
||||
|
||||
// unaligned floating point types
|
||||
typedef endian_arithmetic<order::big, float, 32, align::no> big_float32_t;
|
||||
typedef endian_arithmetic<order::big, double, 64, align::no> big_float64_t;
|
||||
typedef endian_arithmetic<order::little, float, 32, align::no> little_float32_t;
|
||||
typedef endian_arithmetic<order::little, double, 64, align::no> little_float64_t;
|
||||
typedef endian_arithmetic<order::native, float, 32, align::no> native_float32_t;
|
||||
typedef endian_arithmetic<order::native, double, 64, align::no> native_float64_t;
|
||||
|
||||
//---------------------------------- end synopsis ------------------------------------//
|
||||
|
||||
template <BOOST_SCOPED_ENUM(order) Order, class T, std::size_t n_bits,
|
||||
|
@ -102,9 +102,9 @@ namespace endian
|
||||
|
||||
// aligned floating point buffers
|
||||
typedef endian_buffer<order::big, float, 32, align::yes> big_float32_buf_at;
|
||||
typedef endian_buffer<order::big, double, 64, align::yes> big_double64_buf_at;
|
||||
typedef endian_buffer<order::big, double, 64, align::yes> big_float64_buf_at;
|
||||
typedef endian_buffer<order::little, float, 32, align::yes> little_float32_buf_at;
|
||||
typedef endian_buffer<order::little, double, 64, align::yes> little_double64_buf_at;
|
||||
typedef endian_buffer<order::little, double, 64, align::yes> little_float64_buf_at;
|
||||
|
||||
// aligned native endian typedefs are not provided because
|
||||
// <cstdint> types are superior for this use case
|
||||
@ -193,11 +193,11 @@ namespace endian
|
||||
|
||||
// unaligned floating point buffers
|
||||
typedef endian_buffer<order::big, float, 32, align::no> big_float32_buf_t;
|
||||
typedef endian_buffer<order::big, double, 64, align::no> big_double64_buf_t;
|
||||
typedef endian_buffer<order::big, double, 64, align::no> big_float64_buf_t;
|
||||
typedef endian_buffer<order::little, float, 32, align::no> little_float32_buf_t;
|
||||
typedef endian_buffer<order::little, double, 64, align::no> little_double64_buf_t;
|
||||
typedef endian_buffer<order::little, double, 64, align::no> little_float64_buf_t;
|
||||
typedef endian_buffer<order::native, float, 32, align::no> native_float32_buf_t;
|
||||
typedef endian_buffer<order::native, double, 64, align::no> native_double64_buf_t;
|
||||
typedef endian_buffer<order::native, double, 64, align::no> native_float64_buf_t;
|
||||
|
||||
// Stream inserter
|
||||
template <class charT, class traits, BOOST_SCOPED_ENUM(order) Order, class T,
|
||||
|
@ -50,7 +50,7 @@ namespace
|
||||
BOOST_TEST_EQ(sizeof(big_uint64_buf_t), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(big_float32_buf_t), 4u);
|
||||
BOOST_TEST_EQ(sizeof(big_double64_buf_t), 8u);
|
||||
BOOST_TEST_EQ(sizeof(big_float64_buf_t), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(little_int8_buf_t), 1u);
|
||||
BOOST_TEST_EQ(sizeof(little_int16_buf_t), 2u);
|
||||
@ -71,7 +71,7 @@ namespace
|
||||
BOOST_TEST_EQ(sizeof(little_uint64_buf_t), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(little_float32_buf_t), 4u);
|
||||
BOOST_TEST_EQ(sizeof(little_double64_buf_t), 8u);
|
||||
BOOST_TEST_EQ(sizeof(little_float64_buf_t), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(native_int8_buf_t), 1u);
|
||||
BOOST_TEST_EQ(sizeof(native_int16_buf_t), 2u);
|
||||
@ -92,7 +92,7 @@ namespace
|
||||
BOOST_TEST_EQ(sizeof(native_uint64_buf_t), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(native_float32_buf_t), 4u);
|
||||
BOOST_TEST_EQ(sizeof(native_double64_buf_t), 8u);
|
||||
BOOST_TEST_EQ(sizeof(native_float64_buf_t), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(big_int8_buf_at), 1u);
|
||||
BOOST_TEST_EQ(sizeof(big_int16_buf_at), 2u);
|
||||
@ -105,7 +105,7 @@ namespace
|
||||
BOOST_TEST_EQ(sizeof(big_uint64_buf_at), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(big_float32_buf_at), 4u);
|
||||
BOOST_TEST_EQ(sizeof(big_double64_buf_at), 8u);
|
||||
BOOST_TEST_EQ(sizeof(big_float64_buf_at), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(little_int8_buf_at), 1u);
|
||||
BOOST_TEST_EQ(sizeof(little_int16_buf_at), 2u);
|
||||
@ -118,7 +118,7 @@ namespace
|
||||
BOOST_TEST_EQ(sizeof(little_uint64_buf_at), 8u);
|
||||
|
||||
BOOST_TEST_EQ(sizeof(little_float32_buf_at), 4u);
|
||||
BOOST_TEST_EQ(sizeof(little_double64_buf_at), 8u);
|
||||
BOOST_TEST_EQ(sizeof(little_float64_buf_at), 8u);
|
||||
|
||||
} // check_size
|
||||
|
||||
@ -196,7 +196,7 @@ namespace
|
||||
test_buffer_type<big_uint64_buf_at>( 0x0102030405060708ULL, 0xFE02030405060708ULL );
|
||||
|
||||
test_buffer_type<big_float32_buf_at>( +1.5f, -3.14f );
|
||||
test_buffer_type<big_double64_buf_at>( +1.5, -3.14 );
|
||||
test_buffer_type<big_float64_buf_at>( +1.5, -3.14 );
|
||||
|
||||
test_buffer_type< little_int8_buf_at>( 0x01, -0x01 );
|
||||
test_buffer_type<little_int16_buf_at>( 0x0102, -0x0102 );
|
||||
@ -209,7 +209,7 @@ namespace
|
||||
test_buffer_type<little_uint64_buf_at>( 0x0102030405060708ULL, 0xFE02030405060708ULL );
|
||||
|
||||
test_buffer_type<little_float32_buf_at>( +1.5f, -3.14f );
|
||||
test_buffer_type<little_double64_buf_at>( +1.5, -3.14 );
|
||||
test_buffer_type<little_float64_buf_at>( +1.5, -3.14 );
|
||||
|
||||
test_buffer_type< big_int8_buf_t>( 0x01, -0x01 );
|
||||
test_buffer_type<big_int16_buf_t>( 0x0102, -0x0102 );
|
||||
@ -221,7 +221,7 @@ namespace
|
||||
test_buffer_type<big_int64_buf_t>( 0x0102030405060708LL, -0x0102030405060708LL );
|
||||
|
||||
test_buffer_type<big_float32_buf_t>( +1.5f, -3.14f );
|
||||
test_buffer_type<big_double64_buf_t>( +1.5, -3.14 );
|
||||
test_buffer_type<big_float64_buf_t>( +1.5, -3.14 );
|
||||
|
||||
test_buffer_type< little_uint8_buf_t>( 0x01, 0xFE );
|
||||
test_buffer_type<little_uint16_buf_t>( 0x0102, 0xFE02 );
|
||||
@ -233,7 +233,7 @@ namespace
|
||||
test_buffer_type<little_uint64_buf_t>( 0x0102030405060708ULL, 0xFE02030405060708ULL );
|
||||
|
||||
test_buffer_type<little_float32_buf_t>( +1.5f, -3.14f );
|
||||
test_buffer_type<little_double64_buf_t>( +1.5, -3.14 );
|
||||
test_buffer_type<little_float64_buf_t>( +1.5, -3.14 );
|
||||
|
||||
std::cout << "test construction and assignment complete" << std::endl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user