File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -338,17 +338,20 @@ namespace datalog {
338
338
SASSERT (length + m_small_offset <= 64 );
339
339
}
340
340
table_element get (const char * rec) const {
341
- const uint64_t * ptr = reinterpret_cast <const uint64_t *>(rec + m_big_offset);
342
- uint64_t res = *ptr;
341
+
342
+ uint64_t res;
343
+ memcpy (&res, rec + m_big_offset, sizeof (res));
343
344
res >>= m_small_offset;
344
345
res &= m_mask;
345
346
return res;
346
347
}
347
348
void set (char * rec, table_element val) const {
348
349
SASSERT ( (val&~m_mask)==0 ); // the value fits into the column
349
- uint64_t * ptr = reinterpret_cast <uint64_t *>(rec + m_big_offset);
350
- *ptr &= m_write_mask;
351
- *ptr |= val << m_small_offset;
350
+ uint64_t cell;
351
+ memcpy (&cell, rec + m_big_offset, sizeof (cell));
352
+ cell &= m_write_mask;
353
+ cell |= val << m_small_offset;
354
+ memcpy (rec + m_big_offset, &cell, sizeof (cell));
352
355
}
353
356
unsigned next_ofs () const { return m_offset+m_length; }
354
357
};
You can’t perform that action at this time.
0 commit comments