Change name of endianness enum to order. This is often used with namespace qualifier, and endian::order is shorter and reads better than endian::endianness.

Continue infrastructure and test updates.
This commit is contained in:
Beman committed 2013-03-19 09:28:22 -04:00
1 parent 35a3fcb709
commit 736d9cce09
7 files changed
+104 -103

No files matched your search

+12 -10
View File
@@ -8,10 +8,10 @@
#define _CRT_SECURE_NO_WARNINGS
#include <cstdlib>
#include <boost/endian/conversion.hpp>
#include <boost/endian/converters.hpp>
#include <boost/random.hpp>
#include <boost/cstdint.hpp>
#include <boost/endian/support/timer.hpp>
#include <boost/timer/timer.hpp>
#include <iostream>
#include <string>
@@ -34,15 +34,16 @@ namespace
typedef void (*timee_func)(int32_t, int32_t&);
#endif
endian::microsecond_t benchmark(timee_func timee, const char* msg,
endian::microsecond_t overhead = 0)
typedef boost::timer::nanosecond_type nanosecond_t;
nanosecond_t benchmark(timee_func timee, const char* msg,
nanosecond_t overhead = 0)
{
if (verbose)
cout << "\nRunning benchmark..." << endl;
int64_t sum = 0;
endian::times_t times;
endian::microsecond_t cpu_time;
endian::run_timer t(places);
boost::timer::cpu_times times;
nanosecond_t cpu_time;
boost::timer::auto_cpu_timer t(places);
for (long long i = n; i; --i)
{
@@ -53,8 +54,9 @@ namespace
timee(static_cast<int32_t>(i), y);
sum += y;
# endif
}
times = t.stop();
}
t.stop();
times = t.elapsed();
cpu_time = (times.system + times.user) - overhead;
const long double sec = 1000000.0L;
cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
@@ -192,7 +194,7 @@ int main(int argc, char * argv[])
{
process_command_line(argc, argv);
endian::microsecond_t overhead;
nanosecond_t overhead;
#ifndef BOOST_TWO_ARG
overhead = benchmark(modify_noop, "modify no-op");
+5 -5
View File
@@ -107,9 +107,9 @@ namespace
# endif
}
// detect_endianness -----------------------------------------------------//
// detect_order -----------------------------------------------------//
void detect_endianness()
void detect_order()
{
union View
{
@@ -146,7 +146,7 @@ namespace
exit(1);
}
cout << "That should not matter and is presented for your information only.\n";
} // detect_endianness
} // detect_order
// check_data ------------------------------------------------------------//
@@ -714,7 +714,7 @@ namespace
void check_udt()
{
typedef boost::endian::endian< endianness::big, MyInt, 32 > mybig32_t;
typedef boost::endian::endian< order::big, MyInt, 32 > mybig32_t;
mybig32_t v(10);
cout << "+v is " << +v << endl;
@@ -765,7 +765,7 @@ int cpp_main( int argc, char * argv[] )
iterations = atol( argv[1] );
if ( iterations < 1 ) iterations = 1;
detect_endianness();
detect_order();
check_size();
check_alignment();
check_representation_and_range_and_ops();
@@ -32,9 +32,11 @@
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -74,6 +76,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\converter_test.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+5 -11
View File
@@ -11,11 +11,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scoped_enum_emulation_test"
EndProject
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}") = "conversion_test", "conversion_test\conversion_test.vcxproj", "{9FA33B0B-2B00-49E8-A892-E049D86076A9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "benchmark", "benchmark\benchmark.vcxproj", "{C9FEAE75-4DD9-44F5-B302-9910559A91BE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "conversion2_test", "conversion2_test\conversion2_test.vcxproj", "{6FAF820B-F436-46A2-A1DD-4A4B7025C3D0}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "converter_test", "converter_test\converter_test.vcxproj", "{EAE18F4D-AAF2-4C19-86FB-1144B5BD5993}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -43,18 +41,14 @@ Global
{8638A3D8-D121-40BF-82E5-127F1B1B2CB2}.Debug|Win32.Build.0 = Debug|Win32
{8638A3D8-D121-40BF-82E5-127F1B1B2CB2}.Release|Win32.ActiveCfg = Release|Win32
{8638A3D8-D121-40BF-82E5-127F1B1B2CB2}.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
{C9FEAE75-4DD9-44F5-B302-9910559A91BE}.Debug|Win32.ActiveCfg = Debug|Win32
{C9FEAE75-4DD9-44F5-B302-9910559A91BE}.Debug|Win32.Build.0 = Debug|Win32
{C9FEAE75-4DD9-44F5-B302-9910559A91BE}.Release|Win32.ActiveCfg = Release|Win32
{C9FEAE75-4DD9-44F5-B302-9910559A91BE}.Release|Win32.Build.0 = Release|Win32
{6FAF820B-F436-46A2-A1DD-4A4B7025C3D0}.Debug|Win32.ActiveCfg = Debug|Win32
{6FAF820B-F436-46A2-A1DD-4A4B7025C3D0}.Debug|Win32.Build.0 = Debug|Win32
{6FAF820B-F436-46A2-A1DD-4A4B7025C3D0}.Release|Win32.ActiveCfg = Release|Win32
{6FAF820B-F436-46A2-A1DD-4A4B7025C3D0}.Release|Win32.Build.0 = Release|Win32
{EAE18F4D-AAF2-4C19-86FB-1144B5BD5993}.Debug|Win32.ActiveCfg = Debug|Win32
{EAE18F4D-AAF2-4C19-86FB-1144B5BD5993}.Debug|Win32.Build.0 = Debug|Win32
{EAE18F4D-AAF2-4C19-86FB-1144B5BD5993}.Release|Win32.ActiveCfg = Release|Win32
{EAE18F4D-AAF2-4C19-86FB-1144B5BD5993}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+3 -1
View File
@@ -7,7 +7,9 @@
// See documentation at http://www.boost.org/libs/utility/scoped_enum_emulation.html
#include <boost/detail/disable_warnings.hpp>
// #include <boost/detail/disable_warnings.hpp>
// #include <boost/config/warning_disable.hpp>
#include <boost/detail/scoped_enum_emulation.hpp>
#include <boost/assert.hpp>