diff options
Diffstat (limited to 'odb/pgsql/details/endian-traits.cxx')
-rw-r--r-- | odb/pgsql/details/endian-traits.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/odb/pgsql/details/endian-traits.cxx b/odb/pgsql/details/endian-traits.cxx new file mode 100644 index 0000000..ee53e49 --- /dev/null +++ b/odb/pgsql/details/endian-traits.cxx @@ -0,0 +1,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 ()); + } + } +} |