countLeadingZeroBits

This commit is contained in:
krystalgamer 2024-08-20 10:50:04 +01:00
parent 3a97c18505
commit 57a6a8eaad
2 changed files with 14 additions and 4 deletions

View File

@ -357,10 +357,20 @@ void copyConvertBitmap(void const *,i32,i32,void *,i32,i32,i32,i32,bool)
printf("copyConvertBitmap(void const *,i32,i32,void *,i32,i32,i32,i32,bool)");
}
// @SMALLTODO
void countLeadingZeroBits(u32)
// @Ok
i32 countLeadingZeroBits(u32 num)
{
printf("countLeadingZeroBits(u32)");
if (!num)
return 0;
i32 count = 0;
while (num & 1)
{
num >>= 1;
count++;
}
return count;
}
// @MEDIUMTODO

View File

@ -89,7 +89,7 @@ EXPORT void PCTex_UpdateForSoftwareRenderer(void);
EXPORT ClutPC* clutToClutPc(const u16*);
EXPORT void copyBitmap(void const *,i32,void *,i32,i32,i32,i32);
EXPORT void copyConvertBitmap(void const *,i32,i32,void *,i32,i32,i32,i32,bool);
EXPORT void countLeadingZeroBits(u32);
EXPORT i32 countLeadingZeroBits(u32);
EXPORT void downloadTexture(PCTexture *,u16 *,i32,i32);
EXPORT void enumPixelFormatsCB(_DDPIXELFORMAT *,void *);
EXPORT void releaseClutPc(ClutPC *);