From 322fbb5553893f238a8b5896482c87f6313ea0bc Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 26 Aug 2013 14:52:05 +0200 Subject: [PATCH] add another xor swap --- tests/xor.qc | 8 ++++++++ tests/xor.tmpl | 1 + 2 files changed, 9 insertions(+) diff --git a/tests/xor.qc b/tests/xor.qc index cb79972..531a5fb 100644 --- a/tests/xor.qc +++ b/tests/xor.qc @@ -55,4 +55,12 @@ void main() { float swap_y = 200; vector swaps = swap(swap_x, swap_y); print("100:200 swapped is: ", ftos(swaps.x), ":", ftos(swaps.y), "\n"); + + // good olde xor swap test too + vector swap_u = '1 2 3'; + vector swap_v = '4 5 6'; + swap_u ^= swap_v; + swap_v ^= swap_u; + swap_u ^= swap_v; + print("'1 2 3':'4 5 6' swapped is: ", vtos(swap_u), ":", vtos(swap_v), "\n"); } diff --git a/tests/xor.tmpl b/tests/xor.tmpl index 2f0ff10..a08d824 100644 --- a/tests/xor.tmpl +++ b/tests/xor.tmpl @@ -13,3 +13,4 @@ M: vf: '15 8 15' M: vv: '6 8 6' M: vf: '15 8 15' M: 100:200 swapped is: 200:100 +M: '1 2 3':'4 5 6' swapped is: '4 5 6':'1 2 3' -- 2.39.2