hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 9bbdedd642aca60e071dc60572a83b0b19f7cf9a
parent 100592f84465faf5590add0417cd77c000b59be7
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon, 22 Feb 2021 15:45:08 -0500

slice::reverse: xor swap not actually useful here

Diffstat:
Mslice/reverse.ha | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/slice/reverse.ha b/slice/reverse.ha @@ -6,10 +6,9 @@ export fn reverse(b: []void, membsz: size) void = { let a = b: *[*]u8; for (let s = 0z, e = len(b) - 1; s < e) { for (let i = 0z; i < membsz; i += 1z) { - // XOR swap - a[s * membsz + i] ^= a[e * membsz + i]; - a[e * membsz + i] ^= a[s * membsz + i]; - a[s * membsz + i] ^= a[e * membsz + i]; + let z = a[s * membsz + i]; + a[s * membsz + i] = a[e * membsz + i]; + a[e * membsz + i] = z; }; s += 1; e -= 1;