summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-20 14:24:41 +0000
committertoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-20 14:24:41 +0000
commitcc0055f1af5eea3a9253cf3e0e0582f19ea8b512 (patch)
tree64c9b598b394f9263304016185d1885fa5430a40
parent434a50ef97915ae4b4a5c0fe1393c8b264d69082 (diff)
downloadhercules-cc0055f1af5eea3a9253cf3e0e0582f19ea8b512.tar.gz
hercules-cc0055f1af5eea3a9253cf3e0e0582f19ea8b512.tar.bz2
hercules-cc0055f1af5eea3a9253cf3e0e0582f19ea8b512.tar.xz
hercules-cc0055f1af5eea3a9253cf3e0e0582f19ea8b512.zip
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
-rw-r--r--src/common/cbasetypes.h4
1 files changed, 3 insertions, 1 deletions
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))