Skip to content

Commit

Permalink
add alignment guarantees to static char arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mkirchner committed Jan 5, 2024
1 parent 2c65f73 commit a0eb2a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/test_hamt.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,11 @@ MU_TEST_CASE(test_setget_zero)
*/

/* add a single key */
char key[] = "the_key";
char value[] = "the_value";
char key[] __attribute__ ((aligned (8))) = "the_key";
char value[] __attribute__ ((aligned (8))) = "the_value";
const char *val = hamt_set(t, key, value);
MU_ASSERT(hamt_size(t) == 1, "wrong size after set");
MU_ASSERT(strcmp(val, value) == 0, "values are not the same");
MU_ASSERT(val == value, "value should point to the original value");
/* make sure we can find it */
val = hamt_get(t, key);
Expand Down

0 comments on commit a0eb2a4

Please sign in to comment.