News for hackers. Stuff that matters.
Re:Modern Minimal Perfect Hashing: A Survey by mananaysiempre on Wednesday June 11, 2025 @01:43AM (#44244529)
I’m tempted to emulate a conventional SIMD solution and go with a small lookup table:

  uint8_t classify(uint8_t c) {
      return c - (0x5F45452B2B210000ULL >> ((c & 0x70) >> 1));
  }
The AND-then-shift sequence on the right is annoying and it feels like one should be able to avoid it, but I don’t see how. Overall, this is more expensive than it looks—neither a full 64-bit constant nor a variable 64-bit shift are exactly free. So I’m probably missing something here.

There are no comments on this comment yet.