From cc0055f1af5eea3a9253cf3e0e0582f19ea8b512 Mon Sep 17 00:00:00 2001 From: toms Date: Tue, 20 Mar 2007 14:24:41 +0000 Subject: Modified swap #define to avoid 'value computed is not used' warning git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10036 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/cbasetypes.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index eca0d056c..1a1cd22a9 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -230,7 +230,9 @@ typedef char bool; // hmm only ints? //#define swap(a,b) { int temp=a; a=b; b=temp;} // if using macros then something that is type independent -#define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b))) +//#define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b))) +// Avoid "value computed is not used" warning and generates the same assembly code +#define swap(a,b) if (a != b) ((a ^= b), (b ^= a), (a ^= b)) #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) -- cgit v1.2.3-70-g09d2