aboutsummaryrefslogtreecommitdiff
path: root/mysql/types/traits.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'mysql/types/traits.hxx')
-rw-r--r--mysql/types/traits.hxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/mysql/types/traits.hxx b/mysql/types/traits.hxx
index 250343a..7d42798 100644
--- a/mysql/types/traits.hxx
+++ b/mysql/types/traits.hxx
@@ -108,9 +108,14 @@ namespace odb
bool is_null)
{
if (!is_null)
- std::memcpy (&v, s, 1);
+ {
+ v.a = *s & 1;
+ v.b = (*s >> 1) & 1;
+ v.c = (*s >> 2) & 1;
+ v.d = (*s >> 3) & 1;
+ }
else
- std::memset (&v, 0, sizeof (bitfield));
+ v.a = v.b = v.c = v.d = 0;
}
static void
@@ -122,8 +127,7 @@ namespace odb
{
is_null = false;
n = 1;
- std::memcpy (s, &v, 1);
- s[0] &= 0x0F; // Clear unused bits -- MySQL is sensitive about that.
+ *s = v.a | (v.b << 1) | (v.c << 2) | (v.d << 3);
}
};