Skip to content

Instantly share code, notes, and snippets.

@Validark
Created May 20, 2025 19:34
Show Gist options
  • Save Validark/5c5d6bde9ac2f969bdff085c77a95e2c to your computer and use it in GitHub Desktop.
Save Validark/5c5d6bde9ac2f969bdff085c77a95e2c to your computer and use it in GitHub Desktop.
export fn prefixXOR(bitstring: @Vector(8, u64)) @Vector(8, u64) {
var x = bitstring;
x ^= x << @splat(1);
x ^= x << @splat(2);
x ^= x << @splat(4);
x ^= x << @splat(8);
x ^= x << @splat(16);
x ^= x << @splat(32);
x ^= std.simd.shiftElementsRight(x, 1, 0);
x ^= std.simd.shiftElementsRight(x, 2, 0);
x ^= std.simd.shiftElementsRight(x, 4, 0);
return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment