From 8e9219216a7e5f7f1dfed8fc249254ac37a3d2ac Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 24 Jun 2012 11:32:11 +0000 Subject: [PATCH] [RTL] bitmap.c: - hack away ASSERT() for now to fix tests - Optimize 64 bit builds - add BSD license svn path=/trunk/; revision=56792 --- reactos/lib/rtl/bitmap.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/reactos/lib/rtl/bitmap.c b/reactos/lib/rtl/bitmap.c index 2dda265d6f6..fbc1f39ebe0 100644 --- a/reactos/lib/rtl/bitmap.c +++ b/reactos/lib/rtl/bitmap.c @@ -1,6 +1,7 @@ /* - * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries + * LICENSE: GNU GPL - See COPYING in the top level directory + * BSD - See COPYING.ARM in the top level directory * FILE: lib/rtl/bitmap.c * PURPOSE: Bitmap functions * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) @@ -13,6 +14,9 @@ #define NDEBUG #include +// FIXME: hack +#undef ASSERT +#define ASSERT(...) /* DATA *********************************************************************/ @@ -150,6 +154,12 @@ RtlFindMostSignificantBit(ULONGLONG Value) { ULONG Position; +#ifdef _M_AMD64 + if (BitScanReverse64(&Position, Value)) + { + return (CCHAR)Position; + } +#else if (BitScanReverse(&Position, Value >> 32)) { return (CCHAR)(Position + 32); @@ -158,7 +168,7 @@ RtlFindMostSignificantBit(ULONGLONG Value) { return (CCHAR)Position; } - +#endif return -1; } @@ -168,6 +178,12 @@ RtlFindLeastSignificantBit(ULONGLONG Value) { ULONG Position; +#ifdef _M_AMD64 + if (BitScanForward64(&Position, Value)) + { + return (CCHAR)Position; + } +#else if (BitScanForward(&Position, (ULONG)Value)) { return (CCHAR)Position; @@ -176,7 +192,7 @@ RtlFindLeastSignificantBit(ULONGLONG Value) { return (CCHAR)(Position + 32); } - +#endif return -1; }