voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
portable_binary_archive.hpp
1 #ifndef PORTABLE_BINARY_ARCHIVE_HPP
2 #define PORTABLE_BINARY_ARCHIVE_HPP
3 
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 
9 // MS compatible compilers support #pragma once
10 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
11 # pragma once
12 #endif
13 
14 #include <boost/config.hpp>
15 #include <boost/cstdint.hpp>
16 #include <boost/serialization/pfto.hpp>
17 #include <boost/static_assert.hpp>
18 
19 #include <climits>
20 #if CHAR_BIT != 8
21 #error This code assumes an eight-bit byte.
22 #endif
23 
24 #include <boost/archive/basic_archive.hpp>
25 #include <boost/detail/endian.hpp>
26 
27 enum portable_binary_archive_flags {
28  endian_big = 0x4000,
29  endian_little = 0x8000
30 };
31 
32 //#if ( endian_big <= boost::archive::flags_last )
33 //#error archive flags conflict
34 //#endif
35 
36 inline void
37 reverse_bytes(char size, char *address){
38  char * first = address;
39  char * last = first + size - 1;
40  for(;first < last;++first, --last){
41  char x = *last;
42  *last = *first;
43  *first = x;
44  }
45 }
46 
47 #endif // PORTABLE_BINARY_ARCHIVE_HPP