forked from boostorg/endian
Endian: endian_hello_world tweaks
git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@51785 b8fc166d-592f-0410-95f2-cb63ce0dd405
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <boost/integer/endian.hpp>
|
||||
#include <boost/integer/endian_binary_stream.hpp>
|
||||
#include <boost/binary_stream.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace boost;
|
||||
@@ -16,14 +17,10 @@ using namespace boost::integer;
|
||||
|
||||
int main()
|
||||
{
|
||||
int_least32_t value = 0x313233L; // = 3224115 = ASCII { '1', '2', '3' }
|
||||
big24_t big( value );
|
||||
little24_t little( value );
|
||||
|
||||
int_least32_t v = 0x31323334L; // = ASCII { '1', '2', '3', '4' }
|
||||
// value chosen to work on text stream
|
||||
std::cout << "Hello, endian world!\n";
|
||||
std::cout << " cout << value--: " << value << " sizeof(value): " << sizeof(value)
|
||||
<< "\n cout << big----: " << big << " sizeof(big): " << sizeof(big)
|
||||
<< "\n cout << little-: " << little << " sizeof(little): " << sizeof(little)
|
||||
<< '\n';
|
||||
std::cout << v << " " << big32_t(v) << " " << little32_t(v) << '\n';
|
||||
std::cout <= v <= ' ' <= big32_t(v) <= ' ' <= little32_t(v) <= '\n';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user