#include <stdlib.h>
#include <stdarg.h>
+/* gcc defaults to cdecl */
+#if defined(__GNUC__)
+#undef __cdecl
+#define __cdecl
+#endif
+
#include "mkhive.h"
#include <bitmap.c>
-SIZE_T xwcslen( PCWSTR String ) {
- SIZE_T i;
-
- for( i = 0; String[i]; i++ );
-
- return i;
-}
-
-PWSTR xwcschr( PWSTR String, WCHAR Char )
-{
- SIZE_T i;
-
- for( i = 0; String[i] && String[i] != Char; i++ );
-
- if( String[i] ) return &String[i];
- else return NULL;
-}
-
-int xwcsncmp(PCWSTR s1, PCWSTR s2, size_t n)
-{
- while(n--)
- {
- if(*s1 != *s2)
- return 1;
-
- if(*s1 == 0)
- return 0;
-
- s1++;
- s2++;
- }
-
- return 0;
-}
-
/*
* @implemented
*
if(SourceString)
{
- DestSize = xwcslen(SourceString) * sizeof(WCHAR);
+ DestSize = utf16_wcslen(SourceString) * sizeof(WCHAR);
DestinationString->Length = (USHORT)DestSize;
DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR);
}
//DbgBreakPoint();
}
+
+unsigned char BitScanForward(ULONG * Index, unsigned long Mask)
+{
+ *Index = 0;
+ while (Mask && ((Mask & 1) == 0))
+ {
+ Mask >>= 1;
+ ++(*Index);
+ }
+ return Mask ? 1 : 0;
+}
+
+unsigned char BitScanReverse(ULONG * const Index, unsigned long Mask)
+{
+ *Index = 0;
+ while (Mask && ((Mask & (1 << 31)) == 0))
+ {
+ Mask <<= 1;
+ ++(*Index);
+ }
+ return Mask ? 1 : 0;
+}