diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-07-14 23:13:46 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-07-14 23:13:46 +0200 |
commit | 2548ead4f4b740e96c093f07692a50e2bc776f89 (patch) | |
tree | 190ac91cc24e0205c736d3ea0fcbb333dc44b946 /pgsql/types | |
parent | e67830fa25b5cf42428d32b544b115fda44383a3 (diff) |
Aesthetic changes to PostgreSQL BIT test
Diffstat (limited to 'pgsql/types')
-rw-r--r-- | pgsql/types/traits.hxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pgsql/types/traits.hxx b/pgsql/types/traits.hxx index 20d0445..be45aa8 100644 --- a/pgsql/types/traits.hxx +++ b/pgsql/types/traits.hxx @@ -55,6 +55,10 @@ namespace odb } }; + // The first 4 bytes of the image is a signed int specifying the + // number of significant bits contained by the BIT. The following + // bytes contain the bit data. + // template <> class value_traits<bitfield, id_bit> { @@ -71,7 +75,11 @@ namespace odb { if (!is_null) { - unsigned char const* d = i + 4; + assert ( + details::endian_traits::ntoh ( + *reinterpret_cast<const int*> (i)) == 4); + + const unsigned char* d (i + 4); v.a = *d >> 4 & 1; v.b = (*d >> 5) & 1; @@ -146,8 +154,8 @@ namespace odb if (n > b.capacity ()) b.capacity (n); - // PostgreSQL requires all trailing bits of a varbit image - // be zero. + // PostgreSQL requires all trailing bits of a VARBIT image + // to be zero. // std::memset (b.data (), 0, b.capacity ()); |