forked from boostorg/endian
Directory reorg to follow Boost Git practice.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Boost Endian Library test Jamfile
|
||||
|
||||
# Copyright Beman Dawes 2006
|
||||
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
# See library home page at http://www.boost.org/libs/endian
|
||||
|
||||
import testing ;
|
||||
|
||||
test-suite "endian"
|
||||
:
|
||||
[ run endian_test.cpp ]
|
||||
[ run endian_operations_test.cpp
|
||||
: : : <toolset>gcc:<cxxflags>-Wno-sign-compare ]
|
||||
[ run endian_in_union_test.cpp ]
|
||||
[ run conversion_test.cpp ]
|
||||
;
|
||||
@@ -0,0 +1,209 @@
|
||||
// benchmark.cpp ---------------------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2011
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <cstdlib>
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/endian/support/timer.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace boost;
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::vector;
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string command_args;
|
||||
long long n;
|
||||
int places = 2;
|
||||
bool verbose (false);
|
||||
|
||||
#ifndef BOOST_TWO_ARG
|
||||
typedef int32_t (*timee_func)(int32_t);
|
||||
#else
|
||||
typedef void (*timee_func)(int32_t, int32_t&);
|
||||
#endif
|
||||
|
||||
endian::microsecond_t benchmark(timee_func timee, const char* msg,
|
||||
endian::microsecond_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);
|
||||
|
||||
for (long long i = n; i; --i)
|
||||
{
|
||||
# ifndef BOOST_TWO_ARG
|
||||
sum += timee(static_cast<int32_t>(i)) ;
|
||||
# else
|
||||
int32_t y;
|
||||
timee(static_cast<int32_t>(i), y);
|
||||
sum += y;
|
||||
# endif
|
||||
}
|
||||
times = t.stop();
|
||||
cpu_time = (times.system + times.user) - overhead;
|
||||
const long double sec = 1000000.0L;
|
||||
cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
|
||||
cout.precision(places);
|
||||
cout << msg << " " << cpu_time / sec << endl;
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
t.report();
|
||||
cout << " Benchmark complete\n"
|
||||
" sum is " << sum << endl;
|
||||
}
|
||||
return cpu_time;
|
||||
}
|
||||
|
||||
void process_command_line(int argc, char * argv[])
|
||||
{
|
||||
for (int a = 0; a < argc; ++a)
|
||||
{
|
||||
command_args += argv[a];
|
||||
if (a != argc-1)
|
||||
command_args += ' ';
|
||||
}
|
||||
|
||||
cout << command_args << '\n';;
|
||||
|
||||
if (argc >=2)
|
||||
#ifndef _MSC_VER
|
||||
n = std::atoll(argv[1]);
|
||||
#else
|
||||
n = _atoi64(argv[1]);
|
||||
#endif
|
||||
|
||||
for (; argc > 2; ++argv, --argc)
|
||||
{
|
||||
if ( *(argv[2]+1) == 'p' )
|
||||
places = atoi( argv[2]+2 );
|
||||
else if ( *(argv[2]+1) == 'v' )
|
||||
verbose = true;
|
||||
else
|
||||
{
|
||||
cout << "Error - unknown option: " << argv[2] << "\n\n";
|
||||
argc = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
cout << "Usage: benchmark n [Options]\n"
|
||||
" The argument n specifies the number of test cases to run\n"
|
||||
" Options:\n"
|
||||
" -v Verbose messages\n"
|
||||
" -p# Decimal places for times; default -p" << places << "\n";
|
||||
return std::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
inline void in_place(int32_t& x)
|
||||
{
|
||||
x = (static_cast<uint32_t>(x) << 24)
|
||||
| ((static_cast<uint32_t>(x) << 8) & 0x00ff0000)
|
||||
| ((static_cast<uint32_t>(x) >> 8) & 0x0000ff00)
|
||||
| (static_cast<uint32_t>(x) >> 24);
|
||||
}
|
||||
|
||||
inline int32_t by_return(int32_t x)
|
||||
{
|
||||
return (static_cast<uint32_t>(x) << 24)
|
||||
| ((static_cast<uint32_t>(x) << 8) & 0x00ff0000)
|
||||
| ((static_cast<uint32_t>(x) >> 8) & 0x0000ff00)
|
||||
| (static_cast<uint32_t>(x) >> 24);
|
||||
}
|
||||
|
||||
inline int32_t by_return_pyry(int32_t x)
|
||||
{
|
||||
uint32_t step16;
|
||||
step16 = static_cast<uint32_t>(x) << 16 | static_cast<uint32_t>(x) >> 16;
|
||||
return
|
||||
((static_cast<uint32_t>(step16) << 8) & 0xff00ff00)
|
||||
| ((static_cast<uint32_t>(step16) >> 8) & 0x00ff00ff);
|
||||
}
|
||||
|
||||
inline int32_t two_operand(int32_t x, int32_t& y)
|
||||
{
|
||||
return y = ((x << 24) & 0xff000000) | ((x << 8) & 0x00ff0000) | ((x >> 24) & 0x000000ff)
|
||||
| ((x >> 8) & 0x0000ff00);
|
||||
}
|
||||
|
||||
int32_t modify_noop(int32_t x)
|
||||
{
|
||||
int32_t v(x);
|
||||
return v;
|
||||
}
|
||||
|
||||
int32_t modify_in_place(int32_t x)
|
||||
{
|
||||
int32_t v(x);
|
||||
in_place(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
int32_t modify_by_return(int32_t x)
|
||||
{
|
||||
int32_t v(x);
|
||||
return by_return(v);
|
||||
}
|
||||
|
||||
int32_t modify_by_return_pyry(int32_t x)
|
||||
{
|
||||
int32_t v(x);
|
||||
return by_return_pyry(v);
|
||||
}
|
||||
|
||||
void non_modify_assign(int32_t x, int32_t& y)
|
||||
{
|
||||
y = x;
|
||||
}
|
||||
|
||||
void non_modify_two_operand(int32_t x, int32_t& y)
|
||||
{
|
||||
two_operand(x, y);
|
||||
}
|
||||
|
||||
void non_modify_by_return(int32_t x, int32_t& y)
|
||||
{
|
||||
y = by_return(x);
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
//-------------------------------------- main() ---------------------------------------//
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
process_command_line(argc, argv);
|
||||
|
||||
endian::microsecond_t overhead;
|
||||
|
||||
#ifndef BOOST_TWO_ARG
|
||||
overhead = benchmark(modify_noop, "modify no-op");
|
||||
benchmark(modify_in_place, "modify in place", overhead);
|
||||
benchmark(modify_by_return, "modify by return", overhead);
|
||||
benchmark(modify_by_return_pyry, "modify by return", overhead);
|
||||
#else
|
||||
overhead = benchmark(non_modify_assign, "non_modify_assign ");
|
||||
benchmark(non_modify_two_operand, "non_modify_two_operand", overhead);
|
||||
benchmark(non_modify_by_return, "non_modify_by_return ", overhead);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// conversion_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 <boost/endian/detail/disable_warnings.hpp>
|
||||
|
||||
#include <boost/endian/conversion2.hpp>
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace be = boost::endian2;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_reorder()
|
||||
{
|
||||
std::cout << "test_reorder...\n";
|
||||
|
||||
boost::int64_t i64 = 0x0102030405060708LL;
|
||||
BOOST_TEST_EQ(be::reorder(i64), 0x0807060504030201LL);
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(i64)), i64);
|
||||
|
||||
i64 = 0xfefdfcfbfaf9f8f7LL;
|
||||
BOOST_TEST_EQ(be::reorder(i64), static_cast<boost::int64_t>(0xf7f8f9fafbfcfdfeULL));
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(i64)), i64);
|
||||
|
||||
boost::int32_t i32 = 0x01020304;
|
||||
BOOST_TEST_EQ(be::reorder(i32), 0x04030201);
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(i32)), i32);
|
||||
|
||||
i32 = 0xfefdfcfb;
|
||||
BOOST_TEST_EQ(be::reorder(i32), static_cast<boost::int32_t>(0xfbfcfdfe));
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(i32)), i32);
|
||||
|
||||
boost::int16_t i16 = 0x0102;
|
||||
BOOST_TEST_EQ(be::reorder(i16), 0x0201);
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(i16)), i16);
|
||||
|
||||
i16 = static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfefd));
|
||||
BOOST_TEST_EQ(be::reorder(i16), static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfdfe)));
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(i16)), i16);
|
||||
|
||||
boost::uint64_t ui64 = 0x0102030405060708ULL;
|
||||
BOOST_TEST_EQ(be::reorder(ui64), 0x0807060504030201ULL);
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(ui64)), ui64);
|
||||
|
||||
boost::uint32_t ui32 = 0x01020304;
|
||||
BOOST_TEST_EQ(be::reorder(ui32), static_cast<boost::uint32_t>(0x04030201));
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(ui32)), ui32);
|
||||
|
||||
boost::uint16_t ui16 = 0x0102;
|
||||
BOOST_TEST_EQ(be::reorder(ui16), 0x0201);
|
||||
BOOST_TEST_EQ(be::reorder(be::reorder(ui16)), ui16);
|
||||
|
||||
std::cout << " test_reorder complete\n";
|
||||
}
|
||||
|
||||
const boost::int64_t ni64 = 0x0102030405060708LL;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::int64_t bi64 = 0x0102030405060708LL;
|
||||
const boost::int64_t li64 = 0x0807060504030201LL;
|
||||
# else
|
||||
const boost::int64_t bi64 = 0x0807060504030201LL;
|
||||
const boost::int64_t li64 = 0x0102030405060708LL;
|
||||
# endif
|
||||
|
||||
const boost::int32_t ni32 = 0x01020304;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::int32_t bi32 = 0x01020304;
|
||||
const boost::int32_t li32 = 0x04030201;
|
||||
# else
|
||||
const boost::int32_t bi32 = 0x04030201;
|
||||
const boost::int32_t li32 = 0x01020304;
|
||||
# endif
|
||||
|
||||
const boost::int16_t ni16 = 0x0102;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::int16_t bi16 = 0x0102;
|
||||
const boost::int16_t li16 = 0x0201;
|
||||
# else
|
||||
const boost::int16_t bi16 = 0x0201;
|
||||
const boost::int16_t li16 = 0x0102;
|
||||
# endif
|
||||
|
||||
const boost::uint64_t nui64 = 0x0102030405060708ULL;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::uint64_t bui64 = 0x0102030405060708ULL;
|
||||
const boost::uint64_t lui64 = 0x0807060504030201ULL;
|
||||
# else
|
||||
const boost::uint64_t bui64 = 0x0807060504030201ULL;
|
||||
const boost::uint64_t lui64 = 0x0102030405060708ULL;
|
||||
# endif
|
||||
|
||||
const boost::uint32_t nui32 = 0x01020304;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::uint32_t bui32 = 0x01020304;
|
||||
const boost::uint32_t lui32 = 0x04030201;
|
||||
# else
|
||||
const boost::uint32_t bui32 = 0x04030201;
|
||||
const boost::uint32_t lui32 = 0x01020304;
|
||||
# endif
|
||||
|
||||
const boost::uint16_t nui16 = 0x0102;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::uint16_t bui16 = 0x0102;
|
||||
const boost::uint16_t lui16 = 0x0201;
|
||||
# else
|
||||
const boost::uint16_t bui16 = 0x0201;
|
||||
const boost::uint16_t lui16 = 0x0102;
|
||||
# endif
|
||||
|
||||
void test_conditional_reorder()
|
||||
{
|
||||
std::cout << "test_conditional_reorder...\n";
|
||||
|
||||
BOOST_TEST_EQ(be::big(ni64), bi64);
|
||||
BOOST_TEST_EQ(be::big(ni32), bi32);
|
||||
BOOST_TEST_EQ(be::big(ni16), bi16);
|
||||
BOOST_TEST_EQ(be::big(nui64), bui64);
|
||||
BOOST_TEST_EQ(be::big(nui32), bui32);
|
||||
BOOST_TEST_EQ(be::big(nui16), bui16);
|
||||
|
||||
BOOST_TEST_EQ(be::little(ni64), li64);
|
||||
BOOST_TEST_EQ(be::little(ni32), li32);
|
||||
BOOST_TEST_EQ(be::little(ni16), li16);
|
||||
BOOST_TEST_EQ(be::little(nui64), lui64);
|
||||
BOOST_TEST_EQ(be::little(nui32), lui32);
|
||||
BOOST_TEST_EQ(be::little(nui16), lui16);
|
||||
|
||||
BOOST_TEST_EQ(be::big(be::big(ni64)), ni64);
|
||||
BOOST_TEST_EQ(be::big(be::big(ni32)), ni32);
|
||||
BOOST_TEST_EQ(be::big(be::big(ni16)), ni16);
|
||||
BOOST_TEST_EQ(be::big(be::big(nui64)), nui64);
|
||||
BOOST_TEST_EQ(be::big(be::big(nui32)), nui32);
|
||||
BOOST_TEST_EQ(be::big(be::big(nui16)), nui16);
|
||||
|
||||
BOOST_TEST_EQ(be::little(be::little(ni64)), ni64);
|
||||
BOOST_TEST_EQ(be::little(be::little(ni32)), ni32);
|
||||
BOOST_TEST_EQ(be::little(be::little(ni16)), ni16);
|
||||
BOOST_TEST_EQ(be::little(be::little(nui64)), nui64);
|
||||
BOOST_TEST_EQ(be::little(be::little(nui32)), nui32);
|
||||
BOOST_TEST_EQ(be::little(be::little(nui16)), nui16);
|
||||
|
||||
std::cout << " test_conditional_reorder complete\n";
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
int cpp_main(int, char * [])
|
||||
{
|
||||
std::cerr << std::hex;
|
||||
test_reorder();
|
||||
test_conditional_reorder();
|
||||
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/endian/detail/disable_warnings_pop.hpp>
|
||||
@@ -0,0 +1,442 @@
|
||||
// conversion_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 <boost/endian/detail/disable_warnings.hpp>
|
||||
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace be = boost::endian;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_in_place_reorder()
|
||||
{
|
||||
std::cout << "test_in_place_reorder...\n";
|
||||
|
||||
boost::int64_t i64 = 0x0102030405060708LL;
|
||||
be::reorder(i64);
|
||||
BOOST_TEST_EQ(i64, 0x0807060504030201LL);
|
||||
be::reorder(i64);
|
||||
BOOST_TEST_EQ(i64, 0x0102030405060708LL);
|
||||
|
||||
i64 = 0xfefdfcfbfaf9f8f7LL;
|
||||
be::reorder(i64);
|
||||
BOOST_TEST_EQ(i64, static_cast<boost::int64_t>(0xf7f8f9fafbfcfdfeULL));
|
||||
be::reorder(i64);
|
||||
BOOST_TEST_EQ(i64, static_cast<boost::int64_t>(0xfefdfcfbfaf9f8f7ULL));
|
||||
|
||||
boost::int32_t i32 = 0x01020304;
|
||||
be::reorder(i32);
|
||||
BOOST_TEST_EQ(i32, 0x04030201);
|
||||
be::reorder(i32);
|
||||
BOOST_TEST_EQ(i32, 0x01020304);
|
||||
|
||||
i32 = 0xfefdfcfb;
|
||||
be::reorder(i32);
|
||||
BOOST_TEST_EQ(i32, static_cast<boost::int32_t>(0xfbfcfdfe));
|
||||
be::reorder(i32);
|
||||
BOOST_TEST_EQ(i32, static_cast<boost::int32_t>(0xfefdfcfb));
|
||||
|
||||
boost::int16_t i16 = 0x0102;
|
||||
be::reorder(i16);
|
||||
BOOST_TEST_EQ(i16, 0x0201);
|
||||
be::reorder(i16);
|
||||
BOOST_TEST_EQ(i16, 0x0102);
|
||||
|
||||
i16 = static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfefd));
|
||||
be::reorder(i16);
|
||||
BOOST_TEST_EQ(i16, static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfdfe)));
|
||||
be::reorder(i16);
|
||||
BOOST_TEST_EQ(i16, static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfefd)));
|
||||
|
||||
boost::uint64_t ui64 = 0x0102030405060708ULL;
|
||||
be::reorder(ui64);
|
||||
BOOST_TEST_EQ(ui64, 0x0807060504030201ULL);
|
||||
be::reorder(ui64);
|
||||
BOOST_TEST_EQ(ui64, 0x0102030405060708ULL);
|
||||
|
||||
boost::uint32_t ui32 = 0x01020304;
|
||||
be::reorder(ui32);
|
||||
BOOST_TEST_EQ(ui32, static_cast<boost::uint32_t>(0x04030201));
|
||||
be::reorder(ui32);
|
||||
BOOST_TEST_EQ(ui32, static_cast<boost::uint32_t>(0x01020304));
|
||||
|
||||
boost::uint16_t ui16 = 0x0102;
|
||||
be::reorder(ui16);
|
||||
BOOST_TEST_EQ(ui16, 0x0201);
|
||||
be::reorder(ui16);
|
||||
BOOST_TEST_EQ(ui16, static_cast<boost::uint16_t>(0x0102));
|
||||
|
||||
std::cout << " test_in_place_reorder complete\n";
|
||||
}
|
||||
|
||||
void test_copying_reorder()
|
||||
{
|
||||
std::cout << "test_copying_reorder...\n";
|
||||
|
||||
boost::int64_t i64 = 0x0102030405060708LL, j64, k64;
|
||||
be::reorder(i64, j64);
|
||||
BOOST_TEST_EQ(j64, 0x0807060504030201LL);
|
||||
BOOST_TEST_EQ(i64, 0x0102030405060708LL);
|
||||
be::reorder(j64, k64);
|
||||
BOOST_TEST_EQ(k64, 0x0102030405060708LL);
|
||||
|
||||
i64 = 0xfefdfcfbfaf9f8f7LL;
|
||||
be::reorder(i64, j64);
|
||||
BOOST_TEST_EQ(j64, static_cast<boost::int64_t>(0xf7f8f9fafbfcfdfeLL));
|
||||
be::reorder(j64, k64);
|
||||
BOOST_TEST_EQ(k64, static_cast<boost::int64_t>(0xfefdfcfbfaf9f8f7LL));
|
||||
|
||||
boost::int32_t i32 = 0x01020304, j32, k32;
|
||||
be::reorder(i32, j32);
|
||||
BOOST_TEST_EQ(j32, 0x04030201);
|
||||
be::reorder(j32, k32);
|
||||
BOOST_TEST_EQ(k32, 0x01020304);
|
||||
|
||||
i32 = 0xfefdfcfb;
|
||||
be::reorder(i32, j32);
|
||||
BOOST_TEST_EQ(j32, static_cast<boost::int32_t>(0xfbfcfdfe));
|
||||
be::reorder(j32, k32);
|
||||
BOOST_TEST_EQ(k32, static_cast<boost::int32_t>(0xfefdfcfb));
|
||||
|
||||
boost::int16_t i16 = 0x0102, j16, k16;
|
||||
be::reorder(i16, j16);
|
||||
BOOST_TEST_EQ(j16, 0x0201);
|
||||
be::reorder(j16, k16);
|
||||
BOOST_TEST_EQ(k16, 0x0102);
|
||||
|
||||
i16 = static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfefd));
|
||||
be::reorder(i16, j16);
|
||||
BOOST_TEST_EQ(j16, static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfdfe)));
|
||||
be::reorder(j16, k16);
|
||||
BOOST_TEST_EQ(k16, static_cast<boost::int16_t>(static_cast<boost::uint16_t>(0xfefd)));
|
||||
|
||||
boost::uint64_t ui64 = 0x0102030405060708ULL, uj64, uk64;
|
||||
be::reorder(ui64, uj64);
|
||||
BOOST_TEST_EQ(uj64, 0x0807060504030201ULL);
|
||||
be::reorder(uj64, uk64);
|
||||
BOOST_TEST_EQ(uk64, 0x0102030405060708ULL);
|
||||
|
||||
boost::uint32_t ui32 = 0x01020304, uj32, uk32;
|
||||
be::reorder(ui32, uj32);
|
||||
BOOST_TEST_EQ(uj32, static_cast<boost::uint32_t>(0x04030201));
|
||||
be::reorder(uj32, uk32);
|
||||
BOOST_TEST_EQ(uk32, static_cast<boost::uint32_t>(0x01020304));
|
||||
|
||||
boost::uint16_t ui16 = 0x0102, uj16, uk16;
|
||||
be::reorder(ui16, uj16);
|
||||
BOOST_TEST_EQ(uj16, 0x0201);
|
||||
be::reorder(uj16, uk16);
|
||||
BOOST_TEST_EQ(uk16, 0x0102);
|
||||
|
||||
std::cout << " test_copying_reorder complete\n";
|
||||
}
|
||||
|
||||
const boost::int64_t ni64 = 0x0102030405060708LL;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::int64_t bi64 = 0x0102030405060708LL;
|
||||
const boost::int64_t li64 = 0x0807060504030201LL;
|
||||
# else
|
||||
const boost::int64_t bi64 = 0x0807060504030201LL;
|
||||
const boost::int64_t li64 = 0x0102030405060708LL;
|
||||
# endif
|
||||
|
||||
const boost::int32_t ni32 = 0x01020304;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::int32_t bi32 = 0x01020304;
|
||||
const boost::int32_t li32 = 0x04030201;
|
||||
# else
|
||||
const boost::int32_t bi32 = 0x04030201;
|
||||
const boost::int32_t li32 = 0x01020304;
|
||||
# endif
|
||||
|
||||
const boost::int16_t ni16 = 0x0102;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::int16_t bi16 = 0x0102;
|
||||
const boost::int16_t li16 = 0x0201;
|
||||
# else
|
||||
const boost::int16_t bi16 = 0x0201;
|
||||
const boost::int16_t li16 = 0x0102;
|
||||
# endif
|
||||
|
||||
const boost::uint64_t nui64 = 0x0102030405060708ULL;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::uint64_t bui64 = 0x0102030405060708ULL;
|
||||
const boost::uint64_t lui64 = 0x0807060504030201ULL;
|
||||
# else
|
||||
const boost::uint64_t bui64 = 0x0807060504030201ULL;
|
||||
const boost::uint64_t lui64 = 0x0102030405060708ULL;
|
||||
# endif
|
||||
|
||||
const boost::uint32_t nui32 = 0x01020304;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::uint32_t bui32 = 0x01020304;
|
||||
const boost::uint32_t lui32 = 0x04030201;
|
||||
# else
|
||||
const boost::uint32_t bui32 = 0x04030201;
|
||||
const boost::uint32_t lui32 = 0x01020304;
|
||||
# endif
|
||||
|
||||
const boost::uint16_t nui16 = 0x0102;
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
const boost::uint16_t bui16 = 0x0102;
|
||||
const boost::uint16_t lui16 = 0x0201;
|
||||
# else
|
||||
const boost::uint16_t bui16 = 0x0201;
|
||||
const boost::uint16_t lui16 = 0x0102;
|
||||
# endif
|
||||
|
||||
void test_in_place_conditional_reorder()
|
||||
{
|
||||
std::cout << "test_in_place_conditional_reorder...\n";
|
||||
|
||||
boost::int64_t i64;
|
||||
|
||||
i64 = ni64;
|
||||
be::native_to_big(i64);
|
||||
BOOST_TEST_EQ(i64, bi64);
|
||||
|
||||
i64 = ni64;
|
||||
be::native_to_little(i64);
|
||||
BOOST_TEST_EQ(i64, li64);
|
||||
|
||||
i64 = bi64;
|
||||
be::big_to_native(i64);
|
||||
BOOST_TEST_EQ(i64, ni64);
|
||||
|
||||
i64 = li64;
|
||||
be::little_to_native(i64);
|
||||
BOOST_TEST_EQ(i64, ni64);
|
||||
|
||||
boost::uint64_t ui64;
|
||||
|
||||
ui64 = nui64;
|
||||
be::native_to_big(ui64);
|
||||
BOOST_TEST_EQ(ui64, bui64);
|
||||
|
||||
ui64 = nui64;
|
||||
be::native_to_little(ui64);
|
||||
BOOST_TEST_EQ(ui64, lui64);
|
||||
|
||||
ui64 = bui64;
|
||||
be::big_to_native(ui64);
|
||||
BOOST_TEST_EQ(ui64, nui64);
|
||||
|
||||
ui64 = lui64;
|
||||
be::little_to_native(ui64);
|
||||
BOOST_TEST_EQ(ui64, nui64);
|
||||
|
||||
boost::int32_t i32;
|
||||
|
||||
i32 = ni32;
|
||||
be::native_to_big(i32);
|
||||
BOOST_TEST_EQ(i32, bi32);
|
||||
|
||||
i32 = ni32;
|
||||
be::native_to_little(i32);
|
||||
BOOST_TEST_EQ(i32, li32);
|
||||
|
||||
i32 = bi32;
|
||||
be::big_to_native(i32);
|
||||
BOOST_TEST_EQ(i32, ni32);
|
||||
|
||||
i32 = li32;
|
||||
be::little_to_native(i32);
|
||||
BOOST_TEST_EQ(i32, ni32);
|
||||
|
||||
boost::uint32_t ui32;
|
||||
|
||||
ui32 = nui32;
|
||||
be::native_to_big(ui32);
|
||||
BOOST_TEST_EQ(ui32, bui32);
|
||||
|
||||
ui32 = nui32;
|
||||
be::native_to_little(ui32);
|
||||
BOOST_TEST_EQ(ui32, lui32);
|
||||
|
||||
ui32 = bui32;
|
||||
be::big_to_native(ui32);
|
||||
BOOST_TEST_EQ(ui32, nui32);
|
||||
|
||||
ui32 = lui32;
|
||||
be::little_to_native(ui32);
|
||||
BOOST_TEST_EQ(ui32, nui32);
|
||||
|
||||
boost::int16_t i16;
|
||||
|
||||
i16 = ni16;
|
||||
be::native_to_big(i16);
|
||||
BOOST_TEST_EQ(i16, bi16);
|
||||
|
||||
i16 = ni16;
|
||||
be::native_to_little(i16);
|
||||
BOOST_TEST_EQ(i16, li16);
|
||||
|
||||
i16 = bi16;
|
||||
be::big_to_native(i16);
|
||||
BOOST_TEST_EQ(i16, ni16);
|
||||
|
||||
i16 = li16;
|
||||
be::little_to_native(i16);
|
||||
BOOST_TEST_EQ(i16, ni16);
|
||||
|
||||
boost::uint16_t ui16;
|
||||
|
||||
ui16 = nui16;
|
||||
be::native_to_big(ui16);
|
||||
BOOST_TEST_EQ(ui16, bui16);
|
||||
|
||||
ui16 = nui16;
|
||||
be::native_to_little(ui16);
|
||||
BOOST_TEST_EQ(ui16, lui16);
|
||||
|
||||
ui16 = bui16;
|
||||
be::big_to_native(ui16);
|
||||
BOOST_TEST_EQ(ui16, nui16);
|
||||
|
||||
ui16 = lui16;
|
||||
be::little_to_native(ui16);
|
||||
BOOST_TEST_EQ(ui16, nui16);
|
||||
|
||||
std::cout << " test_in_place_conditional_reorder complete\n";
|
||||
}
|
||||
|
||||
void test_copying_conditional_reorder()
|
||||
{
|
||||
std::cout << "test_copying_conditional_reorder...\n";
|
||||
|
||||
boost::int64_t i64, ti64;
|
||||
|
||||
i64 = ni64;
|
||||
be::native_to_big(i64, ti64);
|
||||
BOOST_TEST_EQ(ti64, bi64);
|
||||
|
||||
i64 = ni64;
|
||||
be::native_to_little(i64, ti64);
|
||||
BOOST_TEST_EQ(ti64, li64);
|
||||
|
||||
i64 = bi64;
|
||||
be::big_to_native(i64, ti64);
|
||||
BOOST_TEST_EQ(ti64, ni64);
|
||||
|
||||
i64 = li64;
|
||||
be::little_to_native(i64, ti64);
|
||||
BOOST_TEST_EQ(ti64, ni64);
|
||||
|
||||
boost::uint64_t ui64, tui64;
|
||||
|
||||
ui64 = nui64;
|
||||
be::native_to_big(ui64, tui64);
|
||||
BOOST_TEST_EQ(tui64, bui64);
|
||||
|
||||
ui64 = nui64;
|
||||
be::native_to_little(ui64, tui64);
|
||||
BOOST_TEST_EQ(tui64, lui64);
|
||||
|
||||
ui64 = bui64;
|
||||
be::big_to_native(ui64, tui64);
|
||||
BOOST_TEST_EQ(tui64, nui64);
|
||||
|
||||
ui64 = lui64;
|
||||
be::little_to_native(ui64, tui64);
|
||||
BOOST_TEST_EQ(tui64, nui64);
|
||||
|
||||
boost::int32_t i32, ti32;
|
||||
|
||||
i32 = ni32;
|
||||
be::native_to_big(i32, ti32);
|
||||
BOOST_TEST_EQ(ti32, bi32);
|
||||
|
||||
i32 = ni32;
|
||||
be::native_to_little(i32, ti32);
|
||||
BOOST_TEST_EQ(ti32, li32);
|
||||
|
||||
i32 = bi32;
|
||||
be::big_to_native(i32, ti32);
|
||||
BOOST_TEST_EQ(ti32, ni32);
|
||||
|
||||
i32 = li32;
|
||||
be::little_to_native(i32, ti32);
|
||||
BOOST_TEST_EQ(ti32, ni32);
|
||||
|
||||
boost::uint32_t ui32, tui32;
|
||||
|
||||
ui32 = nui32;
|
||||
be::native_to_big(ui32, tui32);
|
||||
BOOST_TEST_EQ(tui32, bui32);
|
||||
|
||||
ui32 = nui32;
|
||||
be::native_to_little(ui32, tui32);
|
||||
BOOST_TEST_EQ(tui32, lui32);
|
||||
|
||||
ui32 = bui32;
|
||||
be::big_to_native(ui32, tui32);
|
||||
BOOST_TEST_EQ(tui32, nui32);
|
||||
|
||||
ui32 = lui32;
|
||||
be::little_to_native(ui32, tui32);
|
||||
BOOST_TEST_EQ(tui32, nui32);
|
||||
|
||||
boost::int16_t i16, ti16;
|
||||
|
||||
i16 = ni16;
|
||||
be::native_to_big(i16, ti16);
|
||||
BOOST_TEST_EQ(ti16, bi16);
|
||||
|
||||
i16 = ni16;
|
||||
be::native_to_little(i16, ti16);
|
||||
BOOST_TEST_EQ(ti16, li16);
|
||||
|
||||
i16 = bi16;
|
||||
be::big_to_native(i16, ti16);
|
||||
BOOST_TEST_EQ(ti16, ni16);
|
||||
|
||||
i16 = li16;
|
||||
be::little_to_native(i16, ti16);
|
||||
BOOST_TEST_EQ(ti16, ni16);
|
||||
|
||||
boost::uint16_t ui16, tui16;
|
||||
|
||||
ui16 = nui16;
|
||||
be::native_to_big(ui16, tui16);
|
||||
BOOST_TEST_EQ(tui16, bui16);
|
||||
|
||||
ui16 = nui16;
|
||||
be::native_to_little(ui16, tui16);
|
||||
BOOST_TEST_EQ(tui16, lui16);
|
||||
|
||||
ui16 = bui16;
|
||||
be::big_to_native(ui16, tui16);
|
||||
BOOST_TEST_EQ(tui16, nui16);
|
||||
|
||||
ui16 = lui16;
|
||||
be::little_to_native(ui16, tui16);
|
||||
BOOST_TEST_EQ(tui16, nui16);
|
||||
|
||||
std::cout << " test_copying_conditional_reorder complete\n";
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
int cpp_main(int, char * [])
|
||||
{
|
||||
std::cerr << std::hex;
|
||||
test_in_place_reorder();
|
||||
test_copying_reorder();
|
||||
test_in_place_conditional_reorder();
|
||||
test_copying_conditional_reorder();
|
||||
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/endian/detail/disable_warnings_pop.hpp>
|
||||
@@ -0,0 +1,86 @@
|
||||
// endian_in_union_test.cpp -------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2008
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/endian
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#define BOOST_ENDIAN_FORCE_PODNESS
|
||||
|
||||
#include <boost/endian/detail/disable_warnings.hpp>
|
||||
|
||||
#include <boost/endian/integers.hpp>
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::endian;
|
||||
|
||||
union U
|
||||
{
|
||||
big8_t big8;
|
||||
big16_t big16;
|
||||
big24_t big24;
|
||||
big32_t big32;
|
||||
big40_t big40;
|
||||
big48_t big48;
|
||||
big56_t big56;
|
||||
big64_t big64;
|
||||
|
||||
ubig8_t ubig8;
|
||||
ubig16_t ubig16;
|
||||
ubig24_t ubig24;
|
||||
ubig32_t ubig32;
|
||||
ubig40_t ubig40;
|
||||
ubig48_t ubig48;
|
||||
ubig56_t ubig56;
|
||||
ubig64_t ubig64;
|
||||
|
||||
little8_t little8;
|
||||
little16_t little16;
|
||||
little24_t little24;
|
||||
little32_t little32;
|
||||
little40_t little40;
|
||||
little48_t little48;
|
||||
little56_t little56;
|
||||
little64_t little64;
|
||||
|
||||
ulittle8_t ulittle8;
|
||||
ulittle16_t ulittle16;
|
||||
ulittle24_t ulittle24;
|
||||
ulittle32_t ulittle32;
|
||||
ulittle40_t ulittle40;
|
||||
ulittle48_t ulittle48;
|
||||
ulittle56_t ulittle56;
|
||||
ulittle64_t ulittle64;
|
||||
|
||||
native8_t native8;
|
||||
native16_t native16;
|
||||
native24_t native24;
|
||||
native32_t native32;
|
||||
native40_t native40;
|
||||
native48_t native48;
|
||||
native56_t native56;
|
||||
native64_t native64;
|
||||
|
||||
unative8_t unative8;
|
||||
unative16_t unative16;
|
||||
unative24_t unative24;
|
||||
unative32_t unative32;
|
||||
unative40_t unative40;
|
||||
unative48_t unative48;
|
||||
unative56_t unative56;
|
||||
unative64_t unative64;
|
||||
};
|
||||
|
||||
U foo;
|
||||
|
||||
int cpp_main(int, char * [])
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
// endian_operations_test.cpp ----------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2008
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/endian
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// This test probes operator overloading, including interaction between
|
||||
// operand types.
|
||||
|
||||
// See endian_test for tests of endianess correctness, size, and value.
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#define BOOST_ENDIAN_LOG
|
||||
|
||||
#include <boost/endian/detail/disable_warnings.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning( disable : 4242 ) // conversion ..., possible loss of data
|
||||
# pragma warning( disable : 4244 ) // conversion ..., possible loss of data
|
||||
# pragma warning( disable : 4018 ) // signed/unsigned mismatch
|
||||
# pragma warning( disable : 4365 ) // signed/unsigned mismatch
|
||||
# pragma warning( disable : 4389 ) // signed/unsigned mismatch
|
||||
#endif
|
||||
|
||||
#include <boost/endian/integers.hpp>
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
namespace be = boost::endian;
|
||||
|
||||
template <class T1, class T2>
|
||||
struct default_construct
|
||||
{
|
||||
static void test()
|
||||
{
|
||||
T1 o1;
|
||||
o1 = 1; // quiet warnings
|
||||
if (o1) return; // quiet warnings
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct construct
|
||||
{
|
||||
static void test()
|
||||
{
|
||||
T2 o2(1);
|
||||
T1 o1(o2);
|
||||
++o1; // quiet gcc unused variable warning
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct initialize
|
||||
{
|
||||
static void test()
|
||||
{
|
||||
T1 o2(2);
|
||||
T1 o1 = o2;
|
||||
++o1; // quiet gcc unused variable warning
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct assign
|
||||
{
|
||||
static void test()
|
||||
{
|
||||
T2 o2;
|
||||
o2 = 1;
|
||||
T1 o1;
|
||||
o1 = o2;
|
||||
if (o1) return; // quiet warnings
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct relational
|
||||
{
|
||||
static void test()
|
||||
{
|
||||
T1 o1(1);
|
||||
T2 o2(2);
|
||||
if ( o1 == o2 ) return;
|
||||
if ( o1 != o2 ) return;
|
||||
if ( o1 < o2 ) return;
|
||||
if ( o1 <= o2 ) return;
|
||||
if ( o1 > o2 ) return;
|
||||
if ( o1 >= o2 ) return;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct op_plus
|
||||
{
|
||||
static void test()
|
||||
{
|
||||
T1 o1(1);
|
||||
T2 o2(2);
|
||||
T1 o3;
|
||||
|
||||
o3 = +o1;
|
||||
|
||||
o3 = o1 + o2;
|
||||
|
||||
o1 += o2;
|
||||
|
||||
if (o3) return; // quiet warnings
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct op_star
|
||||
{
|
||||
static void test()
|
||||
{
|
||||
T1 o1(1);
|
||||
T2 o2(2);
|
||||
T1 o3;
|
||||
|
||||
o3 = o1 * o2;
|
||||
|
||||
o1 *= o2;
|
||||
|
||||
if (o3) return; // quiet warnings
|
||||
}
|
||||
};
|
||||
|
||||
template <template<class, class> class Test, class T1>
|
||||
void op_test_aux()
|
||||
{
|
||||
#ifdef BOOST_SHORT_ENDIAN_TEST
|
||||
Test<T1, int>::test();
|
||||
Test<T1, unsigned int>::test();
|
||||
Test<T1, be::big16_t>::test();
|
||||
Test<T1, be::ubig64_t>::test();
|
||||
#else
|
||||
Test<T1, char>::test();
|
||||
Test<T1, unsigned char>::test();
|
||||
Test<T1, signed char>::test();
|
||||
Test<T1, short>::test();
|
||||
Test<T1, unsigned short>::test();
|
||||
Test<T1, int>::test();
|
||||
Test<T1, unsigned int>::test();
|
||||
Test<T1, long>::test();
|
||||
Test<T1, unsigned long>::test();
|
||||
Test<T1, long long>::test();
|
||||
Test<T1, unsigned long long>::test();
|
||||
Test<T1, be::big8_t>::test();
|
||||
Test<T1, be::big16_t>::test();
|
||||
Test<T1, be::big24_t>::test();
|
||||
Test<T1, be::big32_t>::test();
|
||||
Test<T1, be::big40_t>::test();
|
||||
Test<T1, be::big48_t>::test();
|
||||
Test<T1, be::big56_t>::test();
|
||||
Test<T1, be::big64_t>::test();
|
||||
Test<T1, be::ubig8_t>::test();
|
||||
Test<T1, be::ubig16_t>::test();
|
||||
Test<T1, be::ubig24_t>::test();
|
||||
Test<T1, be::ubig32_t>::test();
|
||||
Test<T1, be::ubig40_t>::test();
|
||||
Test<T1, be::ubig48_t>::test();
|
||||
Test<T1, be::ubig56_t>::test();
|
||||
Test<T1, be::ubig64_t>::test();
|
||||
Test<T1, be::little8_t>::test();
|
||||
Test<T1, be::little16_t>::test();
|
||||
Test<T1, be::little24_t>::test();
|
||||
Test<T1, be::little32_t>::test();
|
||||
Test<T1, be::little40_t>::test();
|
||||
Test<T1, be::little48_t>::test();
|
||||
Test<T1, be::little56_t>::test();
|
||||
Test<T1, be::little64_t>::test();
|
||||
Test<T1, be::ulittle8_t>::test();
|
||||
Test<T1, be::ulittle16_t>::test();
|
||||
Test<T1, be::ulittle24_t>::test();
|
||||
Test<T1, be::ulittle32_t>::test();
|
||||
Test<T1, be::ulittle40_t>::test();
|
||||
Test<T1, be::ulittle48_t>::test();
|
||||
Test<T1, be::ulittle56_t>::test();
|
||||
Test<T1, be::ulittle64_t>::test();
|
||||
Test<T1, be::native8_t>::test();
|
||||
Test<T1, be::native16_t>::test();
|
||||
Test<T1, be::native24_t>::test();
|
||||
Test<T1, be::native32_t>::test();
|
||||
Test<T1, be::native40_t>::test();
|
||||
Test<T1, be::native48_t>::test();
|
||||
Test<T1, be::native56_t>::test();
|
||||
Test<T1, be::native64_t>::test();
|
||||
Test<T1, be::unative8_t>::test();
|
||||
Test<T1, be::unative16_t>::test();
|
||||
Test<T1, be::unative24_t>::test();
|
||||
Test<T1, be::unative32_t>::test();
|
||||
Test<T1, be::unative40_t>::test();
|
||||
Test<T1, be::unative48_t>::test();
|
||||
Test<T1, be::unative56_t>::test();
|
||||
Test<T1, be::unative64_t>::test();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <template<class, class> class Test>
|
||||
void op_test()
|
||||
{
|
||||
#ifdef BOOST_SHORT_ENDIAN_TEST
|
||||
op_test_aux<Test, unsigned short>();
|
||||
op_test_aux<Test, int>();
|
||||
op_test_aux<Test, be::big32_t>();
|
||||
op_test_aux<Test, be::ubig32_t>();
|
||||
op_test_aux<Test, be::little48_t>();
|
||||
#else
|
||||
op_test_aux<Test, char>();
|
||||
op_test_aux<Test, unsigned char>();
|
||||
op_test_aux<Test, signed char>();
|
||||
op_test_aux<Test, short>();
|
||||
op_test_aux<Test, unsigned short>();
|
||||
op_test_aux<Test, int>();
|
||||
op_test_aux<Test, unsigned int>();
|
||||
op_test_aux<Test, long>();
|
||||
op_test_aux<Test, unsigned long>();
|
||||
op_test_aux<Test, long long>();
|
||||
op_test_aux<Test, unsigned long long>();
|
||||
op_test_aux<Test, be::big8_t>();
|
||||
op_test_aux<Test, be::big16_t>();
|
||||
op_test_aux<Test, be::big24_t>();
|
||||
op_test_aux<Test, be::big32_t>();
|
||||
op_test_aux<Test, be::big40_t>();
|
||||
op_test_aux<Test, be::big48_t>();
|
||||
op_test_aux<Test, be::big56_t>();
|
||||
op_test_aux<Test, be::big64_t>();
|
||||
op_test_aux<Test, be::ubig8_t>();
|
||||
op_test_aux<Test, be::ubig16_t>();
|
||||
op_test_aux<Test, be::ubig24_t>();
|
||||
op_test_aux<Test, be::ubig32_t>();
|
||||
op_test_aux<Test, be::ubig40_t>();
|
||||
op_test_aux<Test, be::ubig48_t>();
|
||||
op_test_aux<Test, be::ubig56_t>();
|
||||
op_test_aux<Test, be::ubig64_t>();
|
||||
op_test_aux<Test, be::little8_t>();
|
||||
op_test_aux<Test, be::little16_t>();
|
||||
op_test_aux<Test, be::little24_t>();
|
||||
op_test_aux<Test, be::little32_t>();
|
||||
op_test_aux<Test, be::little40_t>();
|
||||
op_test_aux<Test, be::little48_t>();
|
||||
op_test_aux<Test, be::little56_t>();
|
||||
op_test_aux<Test, be::little64_t>();
|
||||
op_test_aux<Test, be::ulittle8_t>();
|
||||
op_test_aux<Test, be::ulittle16_t>();
|
||||
op_test_aux<Test, be::ulittle24_t>();
|
||||
op_test_aux<Test, be::ulittle32_t>();
|
||||
op_test_aux<Test, be::ulittle40_t>();
|
||||
op_test_aux<Test, be::ulittle48_t>();
|
||||
op_test_aux<Test, be::ulittle56_t>();
|
||||
op_test_aux<Test, be::ulittle64_t>();
|
||||
op_test_aux<Test, be::native8_t>();
|
||||
op_test_aux<Test, be::native16_t>();
|
||||
op_test_aux<Test, be::native24_t>();
|
||||
op_test_aux<Test, be::native32_t>();
|
||||
op_test_aux<Test, be::native40_t>();
|
||||
op_test_aux<Test, be::native48_t>();
|
||||
op_test_aux<Test, be::native56_t>();
|
||||
op_test_aux<Test, be::native64_t>();
|
||||
op_test_aux<Test, be::unative8_t>();
|
||||
op_test_aux<Test, be::unative16_t>();
|
||||
op_test_aux<Test, be::unative24_t>();
|
||||
op_test_aux<Test, be::unative32_t>();
|
||||
op_test_aux<Test, be::unative40_t>();
|
||||
op_test_aux<Test, be::unative48_t>();
|
||||
op_test_aux<Test, be::unative56_t>();
|
||||
op_test_aux<Test, be::unative64_t>();
|
||||
#endif
|
||||
}
|
||||
|
||||
// main ------------------------------------------------------------------------------//
|
||||
|
||||
int cpp_main(int, char * [])
|
||||
{
|
||||
be::endian_log = false;
|
||||
|
||||
// make sure some simple things work
|
||||
|
||||
be::big32_t o1(1);
|
||||
be::big32_t o2(2L);
|
||||
be::big32_t o3(3LL);
|
||||
be::big64_t o4(1);
|
||||
|
||||
// use cases; if BOOST_ENDIAN_LOG is defined, will output to clog info on
|
||||
// what overloads and conversions are actually being performed.
|
||||
|
||||
be::endian_log = true;
|
||||
|
||||
std::clog << "set up test values\n";
|
||||
be::big32_t big(12345);
|
||||
be::ulittle16_t ulittle(10);
|
||||
be::big64_t result;
|
||||
|
||||
|
||||
std::clog << "\nresult = +big\n";
|
||||
result = +big;
|
||||
|
||||
std::clog << "\nresult = -big\n";
|
||||
result = -big;
|
||||
|
||||
std::clog << "\n++big\n";
|
||||
++big;
|
||||
|
||||
std::clog << "\nresult = big++\n";
|
||||
result = big++;
|
||||
|
||||
std::clog << "\n--big\n";
|
||||
--big;
|
||||
|
||||
std::clog << "\nbig--\n";
|
||||
big--;
|
||||
|
||||
std::clog << "\nresult = big * big\n";
|
||||
result = big * big;
|
||||
|
||||
std::clog << "\nresult = big * big\n";
|
||||
result = big * big;
|
||||
|
||||
std::clog << "\nresult = big * ulittle\n";
|
||||
result = big * ulittle;
|
||||
|
||||
std::clog << "\nbig *= ulittle\n";
|
||||
big *= ulittle;
|
||||
|
||||
std::clog << "\nresult = ulittle * big\n";
|
||||
result = ulittle * big;
|
||||
|
||||
std::clog << "\nresult = big * 5\n";
|
||||
result = big * 5;
|
||||
|
||||
std::clog << "\nbig *= 5\n";
|
||||
big *= 5;
|
||||
|
||||
std::clog << "\nresult = 5 * big\n";
|
||||
result = 5 * big;
|
||||
|
||||
std::clog << "\nresult = ulittle * 5\n";
|
||||
result = ulittle * 5;
|
||||
|
||||
std::clog << "\nresult = 5 * ulittle\n";
|
||||
result = 5 * ulittle;
|
||||
|
||||
std::clog << "\nresult = 5 * 10\n";
|
||||
result = 5 * 10;
|
||||
std::clog << "\n";
|
||||
|
||||
be::endian_log = false;
|
||||
|
||||
// test from Roland Schwarz that detected ambiguities
|
||||
unsigned u;
|
||||
be::ulittle32_t u1;
|
||||
be::ulittle32_t u2;
|
||||
|
||||
u = 1;
|
||||
u1 = 1;
|
||||
u2 = u1 + u;
|
||||
|
||||
// one more wrinkle
|
||||
be::ulittle16_t u3(3);
|
||||
u3 = 3;
|
||||
u2 = u1 + u3;
|
||||
|
||||
// perform the indicated test on ~60*60 operand types
|
||||
|
||||
op_test<default_construct>();
|
||||
op_test<construct>(); // includes copy construction
|
||||
op_test<initialize>();
|
||||
op_test<assign>();
|
||||
op_test<relational>();
|
||||
op_test<op_plus>();
|
||||
op_test<op_star>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,782 @@
|
||||
// endian_test.cpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 1999-2008
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// See library home page at http://www.boost.org/libs/endian
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// This test probes for correct endianess, size, and value.
|
||||
|
||||
// See endian_operations_test for tests of operator correctness and interaction
|
||||
// between operand types.
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <boost/endian/detail/disable_warnings.hpp>
|
||||
|
||||
#include <boost/endian/integers.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <climits>
|
||||
#include <cstdlib> // for atoi(), exit()
|
||||
#include <cstring> // for memcmp()
|
||||
|
||||
using namespace std; // Not the best programming practice, but I
|
||||
using namespace boost; // want to verify this combination of using
|
||||
using namespace boost::endian; // namespaces works. See endian_operations_test
|
||||
// // for tests that don't do "using namespace".
|
||||
|
||||
#define VERIFY(predicate) verify( predicate, __LINE__ )
|
||||
#define VERIFY_SIZE(actual, expected) verify_size( actual, expected, __LINE__ )
|
||||
#define VERIFY_VALUE_AND_OPS(endian_t,expected_t,expected) verify_value_and_ops<endian_t, expected_t>( expected, __LINE__ )
|
||||
#define VERIFY_BIG_REPRESENTATION(t) verify_representation<t>( true, __LINE__ )
|
||||
#define VERIFY_LITTLE_REPRESENTATION(t) verify_representation<t>( false, __LINE__ )
|
||||
#define VERIFY_NATIVE_REPRESENTATION(t) verify_native_representation<t>( __LINE__ )
|
||||
|
||||
namespace
|
||||
{
|
||||
int err_count;
|
||||
|
||||
void verify( bool x, int line )
|
||||
{
|
||||
if ( x ) return;
|
||||
++err_count;
|
||||
cout << "Error: verify failed on line " << line << endl;
|
||||
}
|
||||
|
||||
void verify_size( size_t actual, size_t expected, int line )
|
||||
{
|
||||
if ( actual == expected ) return;
|
||||
++err_count;
|
||||
cout << "Error: verify size failed on line " << line << endl;
|
||||
cout << " A structure with an expected sizeof() " << expected
|
||||
<< " had an actual sizeof() " << actual
|
||||
<< "\n This will cause common uses of <boost/endian.hpp> to fail\n";
|
||||
}
|
||||
|
||||
template <class Endian, class Base>
|
||||
void verify_value_and_ops( const Base & expected, int line )
|
||||
{
|
||||
Endian v( expected );
|
||||
verify( v == expected, line );
|
||||
|
||||
Endian v2;
|
||||
v2.operator=( expected );
|
||||
verify( v2 == expected, line );
|
||||
|
||||
++v; // verify integer_cover_operators being applied to this type -
|
||||
// will fail to compile if no endian<> specialization is present
|
||||
|
||||
v+v;
|
||||
}
|
||||
|
||||
const char * big_rep = "\x12\x34\x56\x78\x9A\xBC\xDE\xF0";
|
||||
const char * little_rep = "\xF0\xDE\xBC\x9A\x78\x56\x34\x12";
|
||||
|
||||
template <class Endian>
|
||||
void verify_representation( bool is_big, int line )
|
||||
{
|
||||
int silence = 0;
|
||||
Endian x ( static_cast<typename Endian::value_type>
|
||||
(0x123456789abcdef0LL + silence) ); // will truncate
|
||||
|
||||
if ( is_big )
|
||||
verify( memcmp( &x,
|
||||
reinterpret_cast<const char*>(big_rep)+8-sizeof(Endian),
|
||||
sizeof(Endian) ) == 0, line );
|
||||
else
|
||||
verify( memcmp( &x, little_rep, sizeof(Endian) ) == 0, line );
|
||||
}
|
||||
|
||||
template <class Endian>
|
||||
inline void verify_native_representation( int line )
|
||||
{
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
verify_representation<Endian>( true, line );
|
||||
# else
|
||||
verify_representation<Endian>( false, line );
|
||||
# endif
|
||||
}
|
||||
|
||||
// detect_endianness -----------------------------------------------------//
|
||||
|
||||
void detect_endianness()
|
||||
{
|
||||
union View
|
||||
{
|
||||
long long i;
|
||||
unsigned char c[8];
|
||||
};
|
||||
|
||||
View v = { 0x0102030405060708LL }; // initialize v.i
|
||||
|
||||
if ( memcmp( v.c, "\10\7\6\5\4\3\2\1", 8) == 0 )
|
||||
{
|
||||
cout << "This machine is little-endian.\n";
|
||||
# ifdef BOOST_BIG_INTEGER_OPERATORS
|
||||
cout << "yet boost/detail/endian.hpp defines BOOST_BIG_INTEGER_OPERATORS.\n"
|
||||
"You must fix boost/detail/endian.hpp for boost/endian.hpp to work correctly.\n"
|
||||
"Please report the fix to the Boost mailing list.\n";
|
||||
exit(1);
|
||||
# endif
|
||||
}
|
||||
else if ( memcmp( v.c, "\1\2\3\4\5\6\7\10", 8) == 0 )
|
||||
{
|
||||
cout << "This machine is big-endian.\n";
|
||||
# ifdef BOOST_LITTLE_INTEGER_OPERATORS
|
||||
cout << "yet boost/detail/endian.hpp defines BOOST__LITTLE_INTEGER_OPERATORS.\n"
|
||||
"You must fix boost/detail/endian.hpp for boost/endian.hpp to work correctly.\n"
|
||||
"Please report the fix to the Boost mailing list.\n";
|
||||
exit(1);
|
||||
# endif
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "This machine is neither strict big-endian nor strict little-endian\n"
|
||||
"You must modify boost/endian.hpp for it to work correctly.\n";
|
||||
exit(1);
|
||||
}
|
||||
cout << "That should not matter and is presented for your information only.\n";
|
||||
} // detect_endianness
|
||||
|
||||
// check_data ------------------------------------------------------------//
|
||||
|
||||
void check_data()
|
||||
{
|
||||
big8_t big8;
|
||||
big16_t big16;
|
||||
big24_t big24;
|
||||
big32_t big32;
|
||||
big40_t big40;
|
||||
big48_t big48;
|
||||
big56_t big56;
|
||||
big64_t big64;
|
||||
|
||||
ubig8_t ubig8;
|
||||
ubig16_t ubig16;
|
||||
ubig24_t ubig24;
|
||||
ubig32_t ubig32;
|
||||
ubig40_t ubig40;
|
||||
ubig48_t ubig48;
|
||||
ubig56_t ubig56;
|
||||
ubig64_t ubig64;
|
||||
|
||||
little8_t little8;
|
||||
little16_t little16;
|
||||
little24_t little24;
|
||||
little32_t little32;
|
||||
little40_t little40;
|
||||
little48_t little48;
|
||||
little56_t little56;
|
||||
little64_t little64;
|
||||
|
||||
ulittle8_t ulittle8;
|
||||
ulittle16_t ulittle16;
|
||||
ulittle24_t ulittle24;
|
||||
ulittle32_t ulittle32;
|
||||
ulittle40_t ulittle40;
|
||||
ulittle48_t ulittle48;
|
||||
ulittle56_t ulittle56;
|
||||
ulittle64_t ulittle64;
|
||||
|
||||
native8_t native8;
|
||||
native16_t native16;
|
||||
native24_t native24;
|
||||
native32_t native32;
|
||||
native40_t native40;
|
||||
native48_t native48;
|
||||
native56_t native56;
|
||||
native64_t native64;
|
||||
|
||||
unative8_t unative8;
|
||||
unative16_t unative16;
|
||||
unative24_t unative24;
|
||||
unative32_t unative32;
|
||||
unative40_t unative40;
|
||||
unative48_t unative48;
|
||||
unative56_t unative56;
|
||||
unative64_t unative64;
|
||||
|
||||
aligned_big16_t aligned_big16;
|
||||
aligned_big32_t aligned_big32;
|
||||
aligned_big64_t aligned_big64;
|
||||
|
||||
aligned_ubig16_t aligned_ubig16;
|
||||
aligned_ubig32_t aligned_ubig32;
|
||||
aligned_ubig64_t aligned_ubig64;
|
||||
|
||||
aligned_little16_t aligned_little16;
|
||||
aligned_little32_t aligned_little32;
|
||||
aligned_little64_t aligned_little64;
|
||||
|
||||
aligned_ulittle16_t aligned_ulittle16 ;
|
||||
aligned_ulittle32_t aligned_ulittle32 ;
|
||||
aligned_ulittle64_t aligned_ulittle64 ;
|
||||
|
||||
VERIFY(big8.data() == reinterpret_cast<const char *>(&big8));
|
||||
VERIFY(big16.data() == reinterpret_cast<const char *>(&big16));
|
||||
VERIFY(big24.data() == reinterpret_cast<const char *>(&big24));
|
||||
VERIFY(big32.data() == reinterpret_cast<const char *>(&big32));
|
||||
VERIFY(big40.data() == reinterpret_cast<const char *>(&big40));
|
||||
VERIFY(big48.data() == reinterpret_cast<const char *>(&big48));
|
||||
VERIFY(big56.data() == reinterpret_cast<const char *>(&big56));
|
||||
VERIFY(big64.data() == reinterpret_cast<const char *>(&big64));
|
||||
|
||||
VERIFY(ubig8.data() == reinterpret_cast<const char *>(&ubig8));
|
||||
VERIFY(ubig16.data() == reinterpret_cast<const char *>(&ubig16));
|
||||
VERIFY(ubig24.data() == reinterpret_cast<const char *>(&ubig24));
|
||||
VERIFY(ubig32.data() == reinterpret_cast<const char *>(&ubig32));
|
||||
VERIFY(ubig40.data() == reinterpret_cast<const char *>(&ubig40));
|
||||
VERIFY(ubig48.data() == reinterpret_cast<const char *>(&ubig48));
|
||||
VERIFY(ubig56.data() == reinterpret_cast<const char *>(&ubig56));
|
||||
VERIFY(ubig64.data() == reinterpret_cast<const char *>(&ubig64));
|
||||
|
||||
VERIFY(little8.data() == reinterpret_cast<const char *>(&little8));
|
||||
VERIFY(little16.data() == reinterpret_cast<const char *>(&little16));
|
||||
VERIFY(little24.data() == reinterpret_cast<const char *>(&little24));
|
||||
VERIFY(little32.data() == reinterpret_cast<const char *>(&little32));
|
||||
VERIFY(little40.data() == reinterpret_cast<const char *>(&little40));
|
||||
VERIFY(little48.data() == reinterpret_cast<const char *>(&little48));
|
||||
VERIFY(little56.data() == reinterpret_cast<const char *>(&little56));
|
||||
VERIFY(little64.data() == reinterpret_cast<const char *>(&little64));
|
||||
|
||||
VERIFY(ulittle8.data() == reinterpret_cast<const char *>(&ulittle8));
|
||||
VERIFY(ulittle16.data() == reinterpret_cast<const char *>(&ulittle16));
|
||||
VERIFY(ulittle24.data() == reinterpret_cast<const char *>(&ulittle24));
|
||||
VERIFY(ulittle32.data() == reinterpret_cast<const char *>(&ulittle32));
|
||||
VERIFY(ulittle40.data() == reinterpret_cast<const char *>(&ulittle40));
|
||||
VERIFY(ulittle48.data() == reinterpret_cast<const char *>(&ulittle48));
|
||||
VERIFY(ulittle56.data() == reinterpret_cast<const char *>(&ulittle56));
|
||||
VERIFY(ulittle64.data() == reinterpret_cast<const char *>(&ulittle64));
|
||||
|
||||
VERIFY(native8.data() == reinterpret_cast<const char *>(&native8));
|
||||
VERIFY(native16.data() == reinterpret_cast<const char *>(&native16));
|
||||
VERIFY(native24.data() == reinterpret_cast<const char *>(&native24));
|
||||
VERIFY(native32.data() == reinterpret_cast<const char *>(&native32));
|
||||
VERIFY(native40.data() == reinterpret_cast<const char *>(&native40));
|
||||
VERIFY(native48.data() == reinterpret_cast<const char *>(&native48));
|
||||
VERIFY(native56.data() == reinterpret_cast<const char *>(&native56));
|
||||
VERIFY(native64.data() == reinterpret_cast<const char *>(&native64));
|
||||
|
||||
VERIFY(unative8.data() == reinterpret_cast<const char *>(&unative8));
|
||||
VERIFY(unative16.data() == reinterpret_cast<const char *>(&unative16));
|
||||
VERIFY(unative24.data() == reinterpret_cast<const char *>(&unative24));
|
||||
VERIFY(unative32.data() == reinterpret_cast<const char *>(&unative32));
|
||||
VERIFY(unative40.data() == reinterpret_cast<const char *>(&unative40));
|
||||
VERIFY(unative48.data() == reinterpret_cast<const char *>(&unative48));
|
||||
VERIFY(unative56.data() == reinterpret_cast<const char *>(&unative56));
|
||||
VERIFY(unative64.data() == reinterpret_cast<const char *>(&unative64));
|
||||
|
||||
VERIFY(aligned_big16.data() == reinterpret_cast<const char *>(&aligned_big16));
|
||||
VERIFY(aligned_big32.data() == reinterpret_cast<const char *>(&aligned_big32));
|
||||
VERIFY(aligned_big64.data() == reinterpret_cast<const char *>(&aligned_big64));
|
||||
|
||||
VERIFY(aligned_ubig16.data() == reinterpret_cast<const char *>(&aligned_ubig16));
|
||||
VERIFY(aligned_ubig32.data() == reinterpret_cast<const char *>(&aligned_ubig32));
|
||||
VERIFY(aligned_ubig64.data() == reinterpret_cast<const char *>(&aligned_ubig64));
|
||||
|
||||
VERIFY(aligned_little16.data() == reinterpret_cast<const char *>(&aligned_little16));
|
||||
VERIFY(aligned_little32.data() == reinterpret_cast<const char *>(&aligned_little32));
|
||||
VERIFY(aligned_little64.data() == reinterpret_cast<const char *>(&aligned_little64));
|
||||
|
||||
VERIFY(aligned_ulittle16.data() == reinterpret_cast<const char *>(&aligned_ulittle16));
|
||||
VERIFY(aligned_ulittle32.data() == reinterpret_cast<const char *>(&aligned_ulittle32));
|
||||
VERIFY(aligned_ulittle64.data() == reinterpret_cast<const char *>(&aligned_ulittle64));
|
||||
|
||||
}
|
||||
|
||||
// check_size ------------------------------------------------------------//
|
||||
|
||||
void check_size()
|
||||
{
|
||||
VERIFY( numeric_limits<signed char>::digits == 7 );
|
||||
VERIFY( numeric_limits<unsigned char>::digits == 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( big8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( big16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( big24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( big32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( big40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( big48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( big56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( big64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( ubig8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( ubig16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( ubig24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( ubig32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( ubig40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( ubig48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( ubig56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( ubig64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( little8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( little16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( little24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( little32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( little40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( little48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( little56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( little64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( ulittle8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( ulittle16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( ulittle24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( ulittle32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( ulittle40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( ulittle48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( ulittle56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( ulittle64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( native8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( native16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( native24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( native32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( native40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( native48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( native56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( native64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( unative8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( unative16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( unative24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( unative32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( unative40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( unative48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( unative56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( unative64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( aligned_big16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( aligned_big32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( aligned_big64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( aligned_ubig16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( aligned_ubig32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( aligned_ubig64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( aligned_little16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( aligned_little32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( aligned_little64_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( aligned_ulittle16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( aligned_ulittle32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( aligned_ulittle64_t ), 8 );
|
||||
} // check_size
|
||||
|
||||
// check_alignment -------------------------------------------------------//
|
||||
|
||||
void check_alignment()
|
||||
{
|
||||
// structs with offsets % 2 == 1 for type of size > 1 to ensure no alignment
|
||||
// bytes added for any size > 1
|
||||
|
||||
struct big_struct
|
||||
{
|
||||
big8_t v0;
|
||||
big16_t v1;
|
||||
big24_t v3;
|
||||
char v6;
|
||||
big32_t v7;
|
||||
big40_t v11;
|
||||
char v16;
|
||||
big48_t v17;
|
||||
big56_t v23;
|
||||
char v30;
|
||||
big64_t v31;
|
||||
};
|
||||
|
||||
struct ubig_struct
|
||||
{
|
||||
ubig8_t v0;
|
||||
ubig16_t v1;
|
||||
ubig24_t v3;
|
||||
char v6;
|
||||
ubig32_t v7;
|
||||
ubig40_t v11;
|
||||
char v16;
|
||||
ubig48_t v17;
|
||||
ubig56_t v23;
|
||||
char v30;
|
||||
ubig64_t v31;
|
||||
};
|
||||
|
||||
struct little_struct
|
||||
{
|
||||
little8_t v0;
|
||||
little16_t v1;
|
||||
little24_t v3;
|
||||
char v6;
|
||||
little32_t v7;
|
||||
little40_t v11;
|
||||
char v16;
|
||||
little48_t v17;
|
||||
little56_t v23;
|
||||
char v30;
|
||||
little64_t v31;
|
||||
};
|
||||
|
||||
struct ulittle_struct
|
||||
{
|
||||
ulittle8_t v0;
|
||||
ulittle16_t v1;
|
||||
ulittle24_t v3;
|
||||
char v6;
|
||||
ulittle32_t v7;
|
||||
ulittle40_t v11;
|
||||
char v16;
|
||||
ulittle48_t v17;
|
||||
ulittle56_t v23;
|
||||
char v30;
|
||||
ulittle64_t v31;
|
||||
};
|
||||
|
||||
struct native_struct
|
||||
{
|
||||
native8_t v0;
|
||||
native16_t v1;
|
||||
native24_t v3;
|
||||
char v6;
|
||||
native32_t v7;
|
||||
native40_t v11;
|
||||
char v16;
|
||||
native48_t v17;
|
||||
native56_t v23;
|
||||
char v30;
|
||||
native64_t v31;
|
||||
};
|
||||
|
||||
struct unative_struct
|
||||
{
|
||||
unative8_t v0;
|
||||
unative16_t v1;
|
||||
unative24_t v3;
|
||||
char v6;
|
||||
unative32_t v7;
|
||||
unative40_t v11;
|
||||
char v16;
|
||||
unative48_t v17;
|
||||
unative56_t v23;
|
||||
char v30;
|
||||
unative64_t v31;
|
||||
};
|
||||
|
||||
int saved_err_count = err_count;
|
||||
|
||||
VERIFY_SIZE( sizeof(big_struct), 39 );
|
||||
VERIFY_SIZE( sizeof(ubig_struct), 39 );
|
||||
VERIFY_SIZE( sizeof(little_struct), 39 );
|
||||
VERIFY_SIZE( sizeof(ulittle_struct), 39 );
|
||||
VERIFY_SIZE( sizeof(native_struct), 39 );
|
||||
VERIFY_SIZE( sizeof(unative_struct), 39 );
|
||||
|
||||
if ( saved_err_count == err_count )
|
||||
{
|
||||
cout <<
|
||||
"Size and alignment for structures of endian types are as expected.\n";
|
||||
}
|
||||
} // check_alignment
|
||||
|
||||
// check_representation_and_range_and_ops --------------------------------//
|
||||
|
||||
void check_representation_and_range_and_ops()
|
||||
{
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big8_t );
|
||||
VERIFY_VALUE_AND_OPS( big8_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( big8_t, int_least8_t, -0x80 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big16_t );
|
||||
VERIFY_VALUE_AND_OPS( big16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( big16_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big24_t );
|
||||
VERIFY_VALUE_AND_OPS( big24_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( big24_t, int_least32_t, -0x800000 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big32_t );
|
||||
VERIFY_VALUE_AND_OPS( big32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( big32_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big40_t );
|
||||
VERIFY_VALUE_AND_OPS( big40_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big40_t, int_least64_t, -0x8000000000LL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big48_t );
|
||||
VERIFY_VALUE_AND_OPS( big48_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big48_t, int_least64_t, -0x800000000000LL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big56_t );
|
||||
VERIFY_VALUE_AND_OPS( big56_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big56_t, int_least64_t, -0x80000000000000LL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big64_t );
|
||||
VERIFY_VALUE_AND_OPS( big64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig8_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig8_t, uint_least8_t, 0xff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig16_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig16_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig24_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig24_t, uint_least32_t, 0xffffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig32_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig32_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig40_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig40_t, uint_least64_t, 0xffffffffffLL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig48_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig48_t, uint_least64_t, 0xffffffffffffLL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig56_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig56_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( ubig64_t );
|
||||
VERIFY_VALUE_AND_OPS( ubig64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little8_t );
|
||||
VERIFY_VALUE_AND_OPS( little8_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( little8_t, int_least8_t, -0x80 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little16_t );
|
||||
VERIFY_VALUE_AND_OPS( little16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( little16_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little24_t );
|
||||
VERIFY_VALUE_AND_OPS( little24_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( little24_t, int_least32_t, -0x800000 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little32_t );
|
||||
VERIFY_VALUE_AND_OPS( little32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( little32_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little40_t );
|
||||
VERIFY_VALUE_AND_OPS( little40_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little40_t, int_least64_t, -0x8000000000LL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little48_t );
|
||||
VERIFY_VALUE_AND_OPS( little48_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little48_t, int_least64_t, -0x800000000000LL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little56_t );
|
||||
VERIFY_VALUE_AND_OPS( little56_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little56_t, int_least64_t, -0x80000000000000LL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little64_t );
|
||||
VERIFY_VALUE_AND_OPS( little64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle8_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle8_t, uint_least8_t, 0xff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle16_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle16_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle24_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle24_t, uint_least32_t, 0xffffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle32_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle32_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle40_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle40_t, uint_least64_t, 0xffffffffffLL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle48_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle48_t, uint_least64_t, 0xffffffffffffLL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle56_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle56_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( ulittle64_t );
|
||||
VERIFY_VALUE_AND_OPS( ulittle64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native8_t );
|
||||
VERIFY_VALUE_AND_OPS( native8_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( native8_t, int_least8_t, -0x80 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native16_t );
|
||||
VERIFY_VALUE_AND_OPS( native16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( native16_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native24_t );
|
||||
VERIFY_VALUE_AND_OPS( native24_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( native24_t, int_least32_t, -0x800000 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native32_t );
|
||||
VERIFY_VALUE_AND_OPS( native32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( native32_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native40_t );
|
||||
VERIFY_VALUE_AND_OPS( native40_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native40_t, int_least64_t, -0x8000000000LL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native48_t );
|
||||
VERIFY_VALUE_AND_OPS( native48_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native48_t, int_least64_t, -0x800000000000LL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native56_t );
|
||||
VERIFY_VALUE_AND_OPS( native56_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native56_t, int_least64_t, -0x80000000000000LL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native64_t );
|
||||
VERIFY_VALUE_AND_OPS( native64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative8_t );
|
||||
VERIFY_VALUE_AND_OPS( unative8_t, uint_least8_t, 0xff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative16_t );
|
||||
VERIFY_VALUE_AND_OPS( unative16_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative24_t );
|
||||
VERIFY_VALUE_AND_OPS( unative24_t, uint_least32_t, 0xffffff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative32_t );
|
||||
VERIFY_VALUE_AND_OPS( unative32_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative40_t );
|
||||
VERIFY_VALUE_AND_OPS( unative40_t, uint_least64_t, 0xffffffffffLL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative48_t );
|
||||
VERIFY_VALUE_AND_OPS( unative48_t, uint_least64_t, 0xffffffffffffLL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative56_t );
|
||||
VERIFY_VALUE_AND_OPS( unative56_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( unative64_t );
|
||||
VERIFY_VALUE_AND_OPS( unative64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( aligned_big16_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_big16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( aligned_big16_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( aligned_big32_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_big32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( aligned_big32_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( aligned_big64_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_big64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( aligned_big64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( aligned_ubig16_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_ubig16_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( aligned_ubig32_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_ubig32_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( aligned_ubig64_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_ubig64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( aligned_little16_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_little16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( aligned_little16_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( aligned_little32_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_little32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( aligned_little32_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( aligned_little64_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_little64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( aligned_little64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( aligned_ulittle16_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_ulittle16_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( aligned_ulittle32_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_ulittle32_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( aligned_ulittle64_t );
|
||||
VERIFY_VALUE_AND_OPS( aligned_ulittle64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
} // check_representation_and_range
|
||||
|
||||
class MyInt
|
||||
{
|
||||
int32_t mx;
|
||||
public:
|
||||
MyInt(int32_t x) : mx(x) {}
|
||||
operator int32_t() const {return mx;}
|
||||
|
||||
//friend int32_t operator+(const MyInt& x) {return x;}
|
||||
};
|
||||
|
||||
void check_udt()
|
||||
{
|
||||
typedef boost::endian::endian< endianness::big, MyInt, 32 > mybig32_t;
|
||||
|
||||
mybig32_t v(10);
|
||||
cout << "+v is " << +v << endl;
|
||||
v += 1;
|
||||
cout << "v is " << +v << endl;
|
||||
v -= 2;
|
||||
cout << "v is " << +v << endl;
|
||||
v *= 2;
|
||||
cout << "v is " << +v << endl;
|
||||
++v;
|
||||
cout << "v is " << +v << endl;
|
||||
--v;
|
||||
cout << "v is " << +v << endl;
|
||||
// cout << "v+v is " << +(v+v) << endl;
|
||||
}
|
||||
|
||||
long iterations = 10000;
|
||||
|
||||
template< class Endian >
|
||||
Endian timing_test( const char * s)
|
||||
{
|
||||
cout << s << " timing test, " << iterations << " iterations: ";
|
||||
// progress_timer t;
|
||||
|
||||
Endian v = 1;
|
||||
for ( long i = 0; i < iterations; ++i )
|
||||
{
|
||||
v += 1;
|
||||
v *= 3;
|
||||
++v;
|
||||
v *= i;
|
||||
if ( i == 0 ) VERIFY_VALUE_AND_OPS( Endian, typename Endian::value_type, 21 );
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
// main ------------------------------------------------------------------------------//
|
||||
|
||||
int cpp_main( int argc, char * argv[] )
|
||||
{
|
||||
cout << "Usage: "
|
||||
<< argv[0] << " [#],\n where # specifies iteration count\n"
|
||||
" default iteration count is " << iterations << endl;
|
||||
|
||||
if ( argc > 1 )
|
||||
iterations = atol( argv[1] );
|
||||
if ( iterations < 1 ) iterations = 1;
|
||||
|
||||
detect_endianness();
|
||||
check_size();
|
||||
check_alignment();
|
||||
check_representation_and_range_and_ops();
|
||||
check_data();
|
||||
check_udt();
|
||||
|
||||
//timing_test<big32_t> ( "big32_t" );
|
||||
//timing_test<aligned_big32_t>( "aligned_big32_t" );
|
||||
//timing_test<little32_t> ( "little32_t" );
|
||||
//timing_test<aligned_little32_t>( "aligned_little32_t" );
|
||||
|
||||
cout << "\n" << err_count << " errors detected\nTest "
|
||||
<< (err_count==0 ? "passed\n\n" : "failed\n\n");
|
||||
|
||||
return err_count ? 1 : 0;
|
||||
} // main
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C9FEAE75-4DD9-44F5-B302-9910559A91BE}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>benchmark</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>d:\endian\stage\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(TargetDir)\$(TargetName).exe" 100</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>d:\endian\stage\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(TargetDir)\$(TargetName).exe" 100000</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\system\src\error_code.cpp" />
|
||||
<ClCompile Include="..\..\..\support\run_timer.cpp" />
|
||||
<ClCompile Include="..\..\..\support\run_timer_ctors.cpp" />
|
||||
<ClCompile Include="..\..\..\support\timer.cpp" />
|
||||
<ClCompile Include="..\..\benchmark.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir>$(TEMP)\$(SolutionName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
</ClCompile>
|
||||
<PostBuildEvent>
|
||||
<Message>Executing test $(TargetName).exe...</Message>
|
||||
<Command>"$(TargetDir)\$(TargetName).exe"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6FAF820B-F436-46A2-A1DD-4A4B7025C3D0}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>conversion2_test</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\conversion2_test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\conversion_test.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9FA33B0B-2B00-49E8-A892-E049D86076A9}</ProjectGuid>
|
||||
<RootNamespace>endian_flip_test</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<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>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
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.vcxproj", "{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}"
|
||||
EndProject
|
||||
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.vcxproj", "{8420E151-B23B-4651-B526-6AB11EF1E278}"
|
||||
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}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{74C201F3-8308-40BE-BC0F-24974DEAF405}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{74C201F3-8308-40BE-BC0F-24974DEAF405}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{74C201F3-8308-40BE-BC0F-24974DEAF405}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{74C201F3-8308-40BE-BC0F-24974DEAF405}.Release|Win32.Build.0 = Release|Win32
|
||||
{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}.Release|Win32.Build.0 = Release|Win32
|
||||
{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Release|Win32.Build.0 = Release|Win32
|
||||
{8420E151-B23B-4651-B526-6AB11EF1E278}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8420E151-B23B-4651-B526-6AB11EF1E278}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8420E151-B23B-4651-B526-6AB11EF1E278}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8420E151-B23B-4651-B526-6AB11EF1E278}.Release|Win32.Build.0 = Release|Win32
|
||||
{8638A3D8-D121-40BF-82E5-127F1B1B2CB2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8638A3D8-D121-40BF-82E5-127F1B1B2CB2}</ProjectGuid>
|
||||
<RootNamespace>endian_example</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<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>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\example\endian_example.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}</ProjectGuid>
|
||||
<RootNamespace>endian_in_union_test</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<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>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\endian_in_union_test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}</ProjectGuid>
|
||||
<RootNamespace>endian_operations_test</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<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>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4552;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\endian_operations_test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{74C201F3-8308-40BE-BC0F-24974DEAF405}</ProjectGuid>
|
||||
<RootNamespace>endian_test</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<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>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\endian_test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8420E151-B23B-4651-B526-6AB11EF1E278}</ProjectGuid>
|
||||
<RootNamespace>scoped_enum_emulation_test</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<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>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\scoped_enum_emulation_test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,46 @@
|
||||
// scoped_enum_emulation_test.cpp ----------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes, 2009
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// See documentation at http://www.boost.org/libs/utility/scoped_enum_emulation.html
|
||||
|
||||
#include <boost/endian/detail/disable_warnings.hpp>
|
||||
|
||||
#include <boost/detail/scoped_enum_emulation.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
BOOST_SCOPED_ENUM_START(traffic_light) { red=0, yellow, green }; BOOST_SCOPED_ENUM_END
|
||||
|
||||
BOOST_SCOPED_ENUM_START(algae) { green=0, red, cyan }; BOOST_SCOPED_ENUM_END
|
||||
|
||||
struct color
|
||||
{
|
||||
BOOST_SCOPED_ENUM_START(value_t) { red, green, blue }; BOOST_SCOPED_ENUM_END
|
||||
BOOST_SCOPED_ENUM(value_t) value;
|
||||
};
|
||||
|
||||
void foo( BOOST_SCOPED_ENUM(algae) arg )
|
||||
{
|
||||
BOOST_ASSERT( arg == algae::cyan );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_SCOPED_ENUM(traffic_light) signal( traffic_light::red );
|
||||
BOOST_SCOPED_ENUM(algae) sample( algae::red );
|
||||
|
||||
BOOST_ASSERT( signal == traffic_light::red );
|
||||
BOOST_ASSERT( sample == algae::red );
|
||||
|
||||
foo( algae::cyan );
|
||||
|
||||
color tracker;
|
||||
tracker.value = color::value_t::blue;
|
||||
|
||||
if (tracker.value == color::value_t::blue) return 0; // quiet warnings
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
@echo off
|
||||
echo Special version of boost_test for sandbox version of endian library.
|
||||
xcopy /D %BOOST_TRUNK%\boost-build.jam ..\..\..\..
|
||||
xcopy /D %BOOST_TRUNK%\boostcpp.jam ..\..\..\..
|
||||
xcopy /D %BOOST_TRUNK%\Jamroot ..\..\..\..
|
||||
set BOOST_BUILD_PATH=%BOOST_TRUNK%\tools\build\v2
|
||||
|
||||
if not $%1==$--help goto nohelp
|
||||
echo Invoke: boost_test [-ts toolset] [bjam-options]
|
||||
echo Default -ts is gcc-4.3,msvc-8.0,msvc-9.0express,msvc-10.0express
|
||||
goto done
|
||||
:nohelp
|
||||
|
||||
if $%1==$-ts goto toolset
|
||||
|
||||
echo Begin test processing...
|
||||
bjam include=%BOOST_TRUNK% --v2 --dump-tests --toolset=gcc-4.3,msvc-8.0,msvc-9.0express,msvc-10.0express %* >bjam.log 2>&1
|
||||
goto jam_log
|
||||
|
||||
:toolset
|
||||
echo Begin test processing...
|
||||
bjam include=%BOOST_TRUNK% --v2 --dump-tests --toolset=%2 %3 %4 %5 %6 %7 %8 %9 >bjam.log 2>&1
|
||||
|
||||
:jam_log
|
||||
echo Begin log processing...
|
||||
process_jam_log --v2 <bjam.log
|
||||
start bjam.log
|
||||
|
||||
echo Begin compiler status processing...
|
||||
call boost_relative_root
|
||||
rem compiler_status barfs on a relative root, so convert it to absolute
|
||||
dir %BOOST_RELATIVE_ROOT% | grep " Directory of " >%TEMP%\babsr.bat
|
||||
%UTIL%\change %TEMP%\babsr.bat " Directory of " "set BOOST_TEST_ABS_ROOT=" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "C:" "c:" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "D:" "d:" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "E:" "e:" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "F:" "f:" >nul
|
||||
call %TEMP%\babsr.bat
|
||||
compiler_status --v2 %BOOST_TEST_ABS_ROOT% test_status.html test_links.html
|
||||
start test_status.html
|
||||
|
||||
:done
|
||||
Reference in New Issue
Block a user