From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- .../libs/endian/test/speed_test_functions.cpp | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/boost/libs/endian/test/speed_test_functions.cpp (limited to 'src/boost/libs/endian/test/speed_test_functions.cpp') diff --git a/src/boost/libs/endian/test/speed_test_functions.cpp b/src/boost/libs/endian/test/speed_test_functions.cpp new file mode 100644 index 00000000..580fc4e1 --- /dev/null +++ b/src/boost/libs/endian/test/speed_test_functions.cpp @@ -0,0 +1,96 @@ +// speed_test_functions.cpp ----------------------------------------------------------// + +// Copyright Beman Dawes 2013 + +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +//--------------------------------------------------------------------------------------// + +// These functions are in a separate compilation unit partially to defeat optimizers +// and partially to create a worst case scenario. They are in a user namespace for +// realism. + +//--------------------------------------------------------------------------------------// + +#ifndef _SCL_SECURE_NO_WARNINGS +# define _SCL_SECURE_NO_WARNINGS +#endif + +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif + +#include "speed_test_functions.hpp" + +namespace user +{ + + int16_t return_x_big_int16(int16_t x, big_int16_t) BOOST_NOEXCEPT { return x; } + int16_t return_x_little_int16(int16_t x, little_int16_t) BOOST_NOEXCEPT { return x; } + int16_t return_x_value_big_int16(int16_t x, big_int16_t) BOOST_NOEXCEPT + { + return conditional_reverse(x); + } + int16_t return_x_value_little_int16(int16_t x, little_int16_t) BOOST_NOEXCEPT + { + return conditional_reverse(x); + } + int16_t return_x_inplace_big_int16(int16_t x, big_int16_t) BOOST_NOEXCEPT + { + conditional_reverse_inplace(x); return x; + } + int16_t return_x_inplace_little_int16(int16_t x, little_int16_t) BOOST_NOEXCEPT + { + conditional_reverse_inplace(x); return x; + } + int16_t return_y_big_int16(int16_t x, big_int16_t y) BOOST_NOEXCEPT { return y; } + int16_t return_y_little_int16(int16_t x, little_int16_t y) BOOST_NOEXCEPT { return y; } + + //------------------------------------------------------------------------------------// + + int32_t return_x_big_int32(int32_t x, big_int32_t) BOOST_NOEXCEPT { return x; } + int32_t return_x_little_int32(int32_t x, little_int32_t) BOOST_NOEXCEPT { return x; } + int32_t return_x_value_big_int32(int32_t x, big_int32_t) BOOST_NOEXCEPT + { + return conditional_reverse(x); + } + int32_t return_x_value_little_int32(int32_t x, little_int32_t) BOOST_NOEXCEPT + { + return conditional_reverse(x); + } + int32_t return_x_inplace_big_int32(int32_t x, big_int32_t) BOOST_NOEXCEPT + { + conditional_reverse_inplace(x); return x; + } + int32_t return_x_inplace_little_int32(int32_t x, little_int32_t) BOOST_NOEXCEPT + { + conditional_reverse_inplace(x); return x; + } + int32_t return_y_big_int32(int32_t x, big_int32_t y) BOOST_NOEXCEPT { return y; } + int32_t return_y_little_int32(int32_t x, little_int32_t y) BOOST_NOEXCEPT { return y; } + + //------------------------------------------------------------------------------------// + + int64_t return_x_big_int64(int64_t x, big_int64_t) BOOST_NOEXCEPT { return x; } + int64_t return_x_little_int64(int64_t x, little_int64_t) BOOST_NOEXCEPT { return x; } + int64_t return_x_value_big_int64(int64_t x, big_int64_t) BOOST_NOEXCEPT + { + return conditional_reverse(x); + } + int64_t return_x_value_little_int64(int64_t x, little_int64_t) BOOST_NOEXCEPT + { + return conditional_reverse(x); + } + int64_t return_x_inplace_big_int64(int64_t x, big_int64_t) BOOST_NOEXCEPT + { + conditional_reverse_inplace(x); return x; + } + int64_t return_x_inplace_little_int64(int64_t x, little_int64_t) BOOST_NOEXCEPT + { + conditional_reverse_inplace(x); return x; + } + int64_t return_y_big_int64(int64_t x, big_int64_t y) BOOST_NOEXCEPT { return y; } + int64_t return_y_little_int64(int64_t x, little_int64_t y) BOOST_NOEXCEPT { return y; } + +} -- cgit v1.2.3