wasSharp
/BitTwiddling.cs |
@@ -0,0 +1,26 @@ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
// Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
// rights of fair usage, the disclaimer and warranty conditions. // |
/////////////////////////////////////////////////////////////////////////// |
|
namespace wasSharp |
{ |
public class BitTwiddling |
{ |
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
/// <summary> |
/// Swaps two integers passed by reference using XOR. |
/// </summary> |
/// <param name="q">first integer to swap</param> |
/// <param name="p">second integer to swap</param> |
public static void wasXORSwap(ref int q, ref int p) |
{ |
q ^= p; |
p ^= q; |
q ^= p; |
} |
} |
} |