Skip to content

Support for value pointers that are not word-aligned #44

@jeffpeterson

Description

@jeffpeterson

Just an FYI! char pointers are not guaranteed to be word-aligned. For example, consider pointers into strings which can point to any byte. My first test of libhamt failed because this static string is not word aligned (the th pointer ended with 0010):

  struct hamt_config cfg = {.key_hash_fn = hash_string,
                            .key_cmp_fn = key_cmp,
                            .ator = &hamt_allocator_default};

  struct hamt *h = hamt_create(&cfg);

  char *hi = "hi";
  char *th = "there";
  hamt_set(h, hi, th);
  const char *v = hamt_get(h, hi);
  assert(key_cmp(v, th) == 0);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions