]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/serialization/example/portable_binary_archive.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / serialization / example / portable_binary_archive.hpp
CommitLineData
7c673cae
FG
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)
11# pragma once
12#endif
13
14#include <boost/config.hpp>
15#include <boost/cstdint.hpp>
16#include <boost/static_assert.hpp>
17
18#include <climits>
19#if CHAR_BIT != 8
20#error This code assumes an eight-bit byte.
21#endif
22
23#include <boost/archive/basic_archive.hpp>
92f5a8d4 24#include <boost/predef/other/endian.h>
7c673cae
FG
25
26enum portable_binary_archive_flags {
27 endian_big = 0x4000,
28 endian_little = 0x8000
29};
30
31//#if ( endian_big <= boost::archive::flags_last )
32//#error archive flags conflict
33//#endif
34
35inline void
36reverse_bytes(char size, char *address){
37 char * first = address;
38 char * last = first + size - 1;
39 for(;first < last;++first, --last){
40 char x = *last;
41 *last = *first;
42 *first = x;
43 }
44}
45
46#endif // PORTABLE_BINARY_ARCHIVE_HPP