News for hackers. Stuff that matters.
Re:That XOR Trick (2020) by lblume on Thursday July 03, 2025 @03:22AM (#44452504)
You can also calculate the XOR-accumulation of all values between 1 and n in O(1) using a lookup table like this:

    [n, 1, n+1, 0][n%4]

There are no comments on this comment yet.