aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/details/endian-traits.cxx
blob: ee53e497be81ec22162fbe54fec4b700d38da3e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// file      : odb/pgsql/details/endian-traits.cxx
// author    : Constantin Michael <constantin@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#include <odb/pgsql/details/endian-traits.hxx>

namespace odb
{
  namespace pgsql
  {
    namespace details
    {
      namespace
      {
        endian_traits::endian
        infer_host_endian ()
        {
          short s (1);
          char* c (reinterpret_cast<char*> (&s));

          return *c == 0 ?
            endian_traits::big :
            endian_traits::little;
        }
      }

      const endian_traits::endian endian_traits::host_endian (
        infer_host_endian ());
    }
  }
}