Author: hbelusca
Date: Sat Oct 11 18:35:23 2014
New Revision: 64680
URL:
http://svn.reactos.org/svn/reactos?rev=64680&view=rev
Log:
[FAST486]
Use a more performant CountLeadingZeros64 version from Timo (tested by Thomas), and
disable the MSVC-specific one until you find a version that works, and is supported for
any CPU.
Modified:
trunk/reactos/lib/fast486/common.inl
Modified: trunk/reactos/lib/fast486/common.inl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.inl?rev…
==============================================================================
--- trunk/reactos/lib/fast486/common.inl [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.inl [iso-8859-1] Sat Oct 11 18:35:23 2014
@@ -26,24 +26,27 @@
#if defined (__GNUC__)
#define CountLeadingZeros64(x) __builtin_clzll(x)
+
+#if 0
#elif (_MSC_VER >= 1500) && defined(_WIN64)
#define CountLeadingZeros64(x) __lzcnt64(x)
#elif (_MSC_VER >= 1500)
#define CountLeadingZeros64(x) ((x) > 0xFFFFFFFFULL) ? __lzcnt((x) >> 32) \
: (__lzcnt(x) + 32)
+#endif
+
#else
- static FORCEINLINE
- ULONG CountLeadingZeros64(ULONGLONG Value)
+ FORCEINLINE
+ ULONG
+ CountLeadingZeros64(ULONGLONG Value)
{
ULONG Count = 0;
- ULONGLONG Mask = 1ULL << 63;
-
- while (!(Value & Mask) && Mask)
+ Value = ~Value;
+ while ((LONGLONG)Value < 0)
{
Count++;
- Mask >>= 1;
- }
-
+ Value <<= 1;
+ }
return Count;
}
#endif