From: Rudolf Polzer Date: Mon, 26 Aug 2013 12:52:05 +0000 (+0200) Subject: add another xor swap X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=322fbb5553893f238a8b5896482c87f6313ea0bc;p=xonotic%2Fgmqcc.git add another xor swap --- 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'