summaryrefslogtreecommitdiff
path: root/src/common/cbasetypes.h
diff options
context:
space:
mode:
authorshennetsind <notind@gmail.com>2013-06-08 12:46:37 -0700
committershennetsind <notind@gmail.com>2013-06-08 12:46:37 -0700
commit9fdea24a67a39e86c2ae4dd032f08021b35942dc (patch)
treefeea3cd428cee18be3da9bf0bee6d4570d9cad02 /src/common/cbasetypes.h
parentb0f866ca419d87fcb3625b45e2437e0a0bb1810e (diff)
parentd73783f22b2bb881aab74524d153d89a5932a199 (diff)
downloadhercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.tar.gz
hercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.tar.bz2
hercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.tar.xz
hercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.zip
Merge pull request #4 from Earisu/master
Attempt to Merge Earisu's Hercules
Diffstat (limited to 'src/common/cbasetypes.h')
-rw-r--r--src/common/cbasetypes.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 731a8b578..bfe8bf8f8 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -281,6 +281,24 @@ typedef char bool;
//#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))
+#if 0 //to be activated soon, more tests needed on how VS works with the macro above
+#ifdef WIN32
+#undef swap
+#define swap(a,b)__asm \
+{ \
+ __asm mov eax, dword ptr [a] \
+ __asm cmp eax, dword ptr [b] \
+ __asm je _ret \
+ __asm xor eax, dword ptr [b] \
+ __asm mov dword ptr [a], eax \
+ __asm xor eax, dword ptr [b] \
+ __asm mov dword ptr [b], eax \
+ __asm xor eax, dword ptr [a] \
+ __asm mov dword ptr [a], eax \
+ __asm _ret: \
+}
+#endif
+#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))