logoalt Hacker News

Building Your Own Efficient uint128 in C++

31 pointsby PaulHouleyesterday at 8:40 PM3 commentsview on HN

Comments

azhenleytoday at 2:07 AM

> we use 256-bit integers in our hot paths and go up to 564 bits for certain edge cases.

Why 564 bits? That’s 70.5 bytes.

reactordevtoday at 1:16 AM

Tangential. A long time ago at a company far far away, this is how we did UUIDs that made up a TenantId and a UserId, using this exact same logic, minus the arithmetic. Great stuff.

(We wanted something UUID like but deterministic that we could easily decompose and do RBAC with, this was prior to the invention of JWT’s, OAuth, and scopes, worked at the time).

PaulHouletoday at 1:52 AM

Makes me think of the bad old days where the platform gave you 8-bit ints and you built everything else yourself... or AVR-8.