"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: MurmurHash2 unaligned access
To:
gameoftrees@openbsd.org
Date:
Thu, 14 Oct 2021 13:12:58 +0200

Download raw body.

Thread
Stefan Sperling:

> Our hash input (SHA1 has object ID) is an uint8_t array type.
> Should we change the type of the key argument to uint8_t * or is the
> cast from void * to unsigned char * safe?

I feel confident that it's safe:

  void *
  memcpy(void *dst0, const void *src0, size_t length)
  {
          char *dst = dst0;
          const char *src = src0;
  ...

> It seems 'data' will be
> accessed in multiples of 4. I don't know sparc64 alignement
> requirements off the top of my head. Is 4 or 8 required?

Natural alignment, i.e., sizeof(type).

memcpy() should be fine.  The alternative is some << | << | << |
monstrosity.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de