From 1713348f8d4f01df9914a572cc5c3b765f91771c Mon Sep 17 00:00:00 2001 From: bemandawes Date: Fri, 27 Aug 2010 14:09:04 +0000 Subject: [PATCH] Add endian_flip.hpp, with tests. Upgrade VC++ to 2010 git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@65051 b8fc166d-592f-0410-95f2-cb63ce0dd405 --- boost/integer/endian_flip.hpp | 96 +++++++++ libs/integer/test/Jamfile.v2 | 1 + .../binary_stream_test.vcproj | 195 ------------------ .../binary_stream_test.vcxproj | 93 +++++++++ .../test/endian-in-sandbox/common.props | 18 ++ .../test/endian-in-sandbox/common.vsprops | 18 -- .../endian-in-sandbox/endian-in-sandbox.sln | 26 ++- .../endian_binary_stream_test.vcproj | 195 ------------------ .../endian_binary_stream_test.vcxproj | 93 +++++++++ .../endian_example/endian_example.vcproj | 195 ------------------ .../endian_example/endian_example.vcxproj | 93 +++++++++ .../endian_flip_test/endian_flip_test.vcxproj | 93 +++++++++ .../endian_hello_world.vcproj | 195 ------------------ .../endian_hello_world.vcxproj | 93 +++++++++ .../endian_in_union_test.vcproj | 194 ----------------- .../endian_in_union_test.vcxproj | 92 +++++++++ .../endian_operations_test.vcproj | 195 ------------------ .../endian_operations_test.vcxproj | 94 +++++++++ .../endian_test/endian_test.vcproj | 195 ------------------ .../endian_test/endian_test.vcxproj | 93 +++++++++ .../scoped_enum_emulation_test.vcproj | 195 ------------------ .../scoped_enum_emulation_test.vcxproj | 93 +++++++++ libs/integer/test/endian_flip_test.cpp | 73 +++++++ 23 files changed, 1041 insertions(+), 1587 deletions(-) create mode 100644 boost/integer/endian_flip.hpp delete mode 100644 libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcxproj create mode 100644 libs/integer/test/endian-in-sandbox/common.props delete mode 100644 libs/integer/test/endian-in-sandbox/common.vsprops delete mode 100644 libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcxproj delete mode 100644 libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcxproj create mode 100644 libs/integer/test/endian-in-sandbox/endian_flip_test/endian_flip_test.vcxproj delete mode 100644 libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcxproj delete mode 100644 libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcxproj delete mode 100644 libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcxproj delete mode 100644 libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcxproj delete mode 100644 libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcproj create mode 100644 libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcxproj create mode 100644 libs/integer/test/endian_flip_test.cpp diff --git a/boost/integer/endian_flip.hpp b/boost/integer/endian_flip.hpp new file mode 100644 index 0000000..69fafe1 --- /dev/null +++ b/boost/integer/endian_flip.hpp @@ -0,0 +1,96 @@ +// endian_flip.hpp -------------------------------------------------------------------// + +// Copyright Beman Dawes 2010 + +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_ENDIAN_FLIP_HPP +#define BOOST_ENDIAN_FLIP_HPP + +#include +namespace boost +{ +namespace integer +{ + void endian_flip(int16_t& x) + { + char* rep = reinterpret_cast(&x); + char tmp; + tmp = *rep; + *rep = *(rep+1); + *(rep+1) = tmp; + } + + void endian_flip(int32_t& x) + { + char* rep = reinterpret_cast(&x); + char tmp; + tmp = *rep; + *rep = *(rep+3); + *(rep+3) = tmp; + tmp = *(rep+1); + *(rep+1) = *(rep+2); + *(rep+2) = tmp; + } + + void endian_flip(int64_t& x) + { + char* rep = reinterpret_cast(&x); + char tmp; + tmp = *rep; + *rep = *(rep+7); + *(rep+7) = tmp; + tmp = *(rep+1); + *(rep+1) = *(rep+6); + *(rep+6) = tmp; + tmp = *(rep+2); + *(rep+2) = *(rep+5); + *(rep+5) = tmp; + tmp = *(rep+3); + *(rep+3) = *(rep+4); + *(rep+4) = tmp; + } + + void endian_flip(uint16_t& x) + { + char* rep = reinterpret_cast(&x); + char tmp; + tmp = *rep; + *rep = *(rep+1); + *(rep+1) = tmp; + } + + void endian_flip(uint32_t& x) + { + char* rep = reinterpret_cast(&x); + char tmp; + tmp = *rep; + *rep = *(rep+3); + *(rep+3) = tmp; + tmp = *(rep+1); + *(rep+1) = *(rep+2); + *(rep+2) = tmp; + } + + void endian_flip(uint64_t& x) + { + char* rep = reinterpret_cast(&x); + char tmp; + tmp = *rep; + *rep = *(rep+7); + *(rep+7) = tmp; + tmp = *(rep+1); + *(rep+1) = *(rep+6); + *(rep+6) = tmp; + tmp = *(rep+2); + *(rep+2) = *(rep+5); + *(rep+5) = tmp; + tmp = *(rep+3); + *(rep+3) = *(rep+4); + *(rep+4) = tmp; + } +} // namespace integer +} // namespace boost + +#endif // BOOST_ENDIAN_FLIP_HPP diff --git a/libs/integer/test/Jamfile.v2 b/libs/integer/test/Jamfile.v2 index b5862f2..38e2fb9 100644 --- a/libs/integer/test/Jamfile.v2 +++ b/libs/integer/test/Jamfile.v2 @@ -18,4 +18,5 @@ : : : gcc:-Wno-sign-compare ] [ run endian_in_union_test.cpp ] [ run scoped_enum_emulation_test.cpp ] + [ run endian_flip_test.cpp ] ; diff --git a/libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcproj b/libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcproj deleted file mode 100644 index e3c0fa9..0000000 --- a/libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcxproj b/libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcxproj new file mode 100644 index 0000000..35e43da --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/binary_stream_test/binary_stream_test.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {1382D085-FF3F-4573-8709-E10D3D74D620} + binary_stream_test + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/common.props b/libs/integer/test/endian-in-sandbox/common.props new file mode 100644 index 0000000..3dfbaad --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/common.props @@ -0,0 +1,18 @@ + + + + <_ProjectFileVersion>10.0.30319.1 + $(TEMP)\$(SolutionName)\$(Configuration)\ + $(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\ + + + + $(BOOST_SANDBOX)\endian;$(BOOST_TRUNK);%(AdditionalIncludeDirectories) + EnableAllWarnings + + + Executing test $(TargetName).exe... + "$(TargetDir)\$(TargetName).exe" + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/common.vsprops b/libs/integer/test/endian-in-sandbox/common.vsprops deleted file mode 100644 index 65f2675..0000000 --- a/libs/integer/test/endian-in-sandbox/common.vsprops +++ /dev/null @@ -1,18 +0,0 @@ - - - - - diff --git a/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln b/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln index 50a4778..444543a 100644 --- a/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln +++ b/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln @@ -1,21 +1,23 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_test", "endian_test\endian_test.vcproj", "{74C201F3-8308-40BE-BC0F-24974DEAF405}" +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_test", "endian_test\endian_test.vcxproj", "{74C201F3-8308-40BE-BC0F-24974DEAF405}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_in_union_test", "endian_in_union_test\endian_in_union_test.vcproj", "{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_in_union_test", "endian_in_union_test\endian_in_union_test.vcxproj", "{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_operations_test", "endian_operations_test\endian_operations_test.vcproj", "{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_operations_test", "endian_operations_test\endian_operations_test.vcxproj", "{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scoped_enum_emulation_test", "scoped_enum_emulation_test\scoped_enum_emulation_test.vcproj", "{8420E151-B23B-4651-B526-6AB11EF1E278}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scoped_enum_emulation_test", "scoped_enum_emulation_test\scoped_enum_emulation_test.vcxproj", "{8420E151-B23B-4651-B526-6AB11EF1E278}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_example", "endian_example\endian_example.vcproj", "{8638A3D8-D121-40BF-82E5-127F1B1B2CB2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_example", "endian_example\endian_example.vcxproj", "{8638A3D8-D121-40BF-82E5-127F1B1B2CB2}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_hello_world", "endian_hello_world\endian_hello_world.vcproj", "{1AAEBB4E-501E-417E-9531-04469AF5DD8B}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_hello_world", "endian_hello_world\endian_hello_world.vcxproj", "{1AAEBB4E-501E-417E-9531-04469AF5DD8B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "binary_stream_test", "binary_stream_test\binary_stream_test.vcproj", "{1382D085-FF3F-4573-8709-E10D3D74D620}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "binary_stream_test", "binary_stream_test\binary_stream_test.vcxproj", "{1382D085-FF3F-4573-8709-E10D3D74D620}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_binary_stream_test", "endian_binary_stream_test\endian_binary_stream_test.vcproj", "{AD46E04C-C1E1-446E-8D5F-E11B6C438181}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_binary_stream_test", "endian_binary_stream_test\endian_binary_stream_test.vcxproj", "{AD46E04C-C1E1-446E-8D5F-E11B6C438181}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_flip_test", "endian_flip_test\endian_flip_test.vcxproj", "{9FA33B0B-2B00-49E8-A892-E049D86076A9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -55,6 +57,10 @@ Global {AD46E04C-C1E1-446E-8D5F-E11B6C438181}.Debug|Win32.Build.0 = Debug|Win32 {AD46E04C-C1E1-446E-8D5F-E11B6C438181}.Release|Win32.ActiveCfg = Release|Win32 {AD46E04C-C1E1-446E-8D5F-E11B6C438181}.Release|Win32.Build.0 = Release|Win32 + {9FA33B0B-2B00-49E8-A892-E049D86076A9}.Debug|Win32.ActiveCfg = Debug|Win32 + {9FA33B0B-2B00-49E8-A892-E049D86076A9}.Debug|Win32.Build.0 = Debug|Win32 + {9FA33B0B-2B00-49E8-A892-E049D86076A9}.Release|Win32.ActiveCfg = Release|Win32 + {9FA33B0B-2B00-49E8-A892-E049D86076A9}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcproj b/libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcproj deleted file mode 100644 index 657da0a..0000000 --- a/libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcxproj b/libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcxproj new file mode 100644 index 0000000..1661b9e --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_binary_stream_test/endian_binary_stream_test.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {AD46E04C-C1E1-446E-8D5F-E11B6C438181} + endian_binary_stream_test + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcproj b/libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcproj deleted file mode 100644 index b89cb61..0000000 --- a/libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcxproj b/libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcxproj new file mode 100644 index 0000000..9255b4a --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_example/endian_example.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {8638A3D8-D121-40BF-82E5-127F1B1B2CB2} + endian_example + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/endian_flip_test/endian_flip_test.vcxproj b/libs/integer/test/endian-in-sandbox/endian_flip_test/endian_flip_test.vcxproj new file mode 100644 index 0000000..b1efbd3 --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_flip_test/endian_flip_test.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + {9FA33B0B-2B00-49E8-A892-E049D86076A9} + endian_flip_test + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcproj b/libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcproj deleted file mode 100644 index b8f0336..0000000 --- a/libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcxproj b/libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcxproj new file mode 100644 index 0000000..3616313 --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_hello_world/endian_hello_world.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {1AAEBB4E-501E-417E-9531-04469AF5DD8B} + endian_hello_world + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcproj b/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcproj deleted file mode 100644 index cebb66e..0000000 --- a/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcproj +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcxproj b/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcxproj new file mode 100644 index 0000000..68808ed --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcxproj @@ -0,0 +1,92 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {3926C6DC-9D1E-4227-BEF5-81F5EC621A75} + endian_in_union_test + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + %(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcproj b/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcproj deleted file mode 100644 index 37ff6c5..0000000 --- a/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcxproj b/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcxproj new file mode 100644 index 0000000..1876f1f --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcxproj @@ -0,0 +1,94 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A0060A5B-673C-4AD8-BD08-A5C643B1A1CB} + endian_operations_test + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + true + false + + + + Disabled + %(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + false + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + 4552;%(DisableSpecificWarnings) + + + true + Console + MachineX86 + + + + + MaxSpeed + true + %(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj b/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj deleted file mode 100644 index c37e2f5..0000000 --- a/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcxproj b/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcxproj new file mode 100644 index 0000000..afe2fda --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {74C201F3-8308-40BE-BC0F-24974DEAF405} + endian_test + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + %(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + %(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcproj b/libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcproj deleted file mode 100644 index 93ecd65..0000000 --- a/libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcxproj b/libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcxproj new file mode 100644 index 0000000..10fd761 --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/scoped_enum_emulation_test/scoped_enum_emulation_test.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {8420E151-B23B-4651-B526-6AB11EF1E278} + scoped_enum_emulation_test + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/libs/integer/test/endian_flip_test.cpp b/libs/integer/test/endian_flip_test.cpp new file mode 100644 index 0000000..4e5af68 --- /dev/null +++ b/libs/integer/test/endian_flip_test.cpp @@ -0,0 +1,73 @@ +// endian_flip_test.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2010 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +//--------------------------------------------------------------------------------------// + +#include +#include + +namespace bi = boost::integer; + +int main() +{ + boost::int64_t i64 = 0x0102030405060708; + bi::endian_flip(i64); + BOOST_TEST_EQ(i64, 0x0807060504030201); + bi::endian_flip(i64); + BOOST_TEST_EQ(i64, 0x0102030405060708); + + i64 = 0xfefdfcfbfaf9f8f7; + bi::endian_flip(i64); + BOOST_TEST_EQ(i64, 0xf7f8f9fafbfcfdfe); + bi::endian_flip(i64); + BOOST_TEST_EQ(i64, 0xfefdfcfbfaf9f8f7); + + boost::int32_t i32 = 0x01020304; + bi::endian_flip(i32); + BOOST_TEST_EQ(i32, 0x04030201); + bi::endian_flip(i32); + BOOST_TEST_EQ(i32, 0x01020304); + + i32 = 0xfefdfcfb; + bi::endian_flip(i32); + BOOST_TEST_EQ(i32, 0xfbfcfdfe); + bi::endian_flip(i32); + BOOST_TEST_EQ(i32, 0xfefdfcfb); + + boost::int16_t i16 = 0x0102; + bi::endian_flip(i16); + BOOST_TEST_EQ(i16, 0x0201); + bi::endian_flip(i16); + BOOST_TEST_EQ(i16, 0x0102); + + i16 = (boost::int16_t)0xfefd; + bi::endian_flip(i16); + BOOST_TEST_EQ(i16, (boost::int16_t)0xfdfe); + bi::endian_flip(i16); + BOOST_TEST_EQ(i16, (boost::int16_t)0xfefd); + + boost::uint64_t ui64 = 0x0102030405060708; + bi::endian_flip(ui64); + BOOST_TEST_EQ(ui64, 0x0807060504030201); + bi::endian_flip(ui64); + BOOST_TEST_EQ(ui64, 0x0102030405060708); + + boost::uint32_t ui32 = 0x01020304; + bi::endian_flip(ui32); + BOOST_TEST_EQ(ui32, 0x04030201); + bi::endian_flip(ui32); + BOOST_TEST_EQ(ui32, 0x01020304); + + boost::uint16_t ui16 = 0x0102; + bi::endian_flip(ui16); + BOOST_TEST_EQ(ui16, 0x0201); + bi::endian_flip(ui16); + BOOST_TEST_EQ(ui16, 0x0102); + + + return ::boost::report_errors(); +}