Changeset 102245 in vbox
- Timestamp:
- Nov 22, 2023 10:43:09 AM (12 months ago)
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/Makefile.kmk
r102243 r102245 429 429 nsprpub/pr/src/io/prprf.c \ 430 430 nsprpub/pr/src/misc/prinrval.c \ 431 nsprpub/pr/src/misc/prlog2.c \432 431 nsprpub/pr/src/misc/prlong.c \ 433 432 nsprpub/lib/ds/plarena.c \ -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prbit.h
r11551 r102245 39 39 #define prbit_h___ 40 40 41 #include <iprt/cdefs.h> 42 41 43 #include "prtypes.h" 42 43 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP44 #define PR_CeilingLog2 VBoxNsprPR_CeilingLog245 #define PR_FloorLog2 VBoxNsprPR_FloorLog246 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */47 44 48 45 PR_BEGIN_EXTERN_C … … 63 60 ** Compute the log of the least power of 2 greater than or equal to n 64 61 */ 65 NSPR_API(PRIntn) PR_CeilingLog2(PRUint32 i); 62 DECL_FORCE_INLINE(PRIntn) PR_CeilingLog2(PRUint32 n) 63 { 64 PRIntn log2 = 0; 65 66 if (n & (n-1)) 67 log2++; 68 if (n >> 16) 69 log2 += 16, n >>= 16; 70 if (n >> 8) 71 log2 += 8, n >>= 8; 72 if (n >> 4) 73 log2 += 4, n >>= 4; 74 if (n >> 2) 75 log2 += 2, n >>= 2; 76 if (n >> 1) 77 log2++; 78 return log2; 79 } 66 80 67 81 /* 68 ** Compute the log of the greatest power of 2 less than or equal to n 82 ** Compute the log of the greatest power of 2 less than or equal to n. 83 ** This really just finds the highest set bit in the word. 69 84 */ 70 NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i); 85 DECL_FORCE_INLINE(PRIntn) PR_FloorLog2(PRUint32 n) 86 { 87 PRIntn log2 = 0; 88 89 if (n >> 16) 90 log2 += 16, n >>= 16; 91 if (n >> 8) 92 log2 += 8, n >>= 8; 93 if (n >> 4) 94 log2 += 4, n >>= 4; 95 if (n >> 2) 96 log2 += 2, n >>= 2; 97 if (n >> 1) 98 log2++; 99 return log2; 100 } 71 101 72 102 /*
Note:
See TracChangeset
for help on using the changeset viewer.