| Index: nss/mozilla/nsprpub/pr/src/misc/prlog2.c
|
| ===================================================================
|
| --- nss/mozilla/nsprpub/pr/src/misc/prlog2.c (revision 55475)
|
| +++ nss/mozilla/nsprpub/pr/src/misc/prlog2.c (working copy)
|
| @@ -42,20 +42,8 @@
|
| */
|
| PR_IMPLEMENT(PRIntn) PR_CeilingLog2(PRUint32 n)
|
| {
|
| - PRIntn log2 = 0;
|
| -
|
| - if (n & (n-1))
|
| - log2++;
|
| - if (n >> 16)
|
| - log2 += 16, n >>= 16;
|
| - if (n >> 8)
|
| - log2 += 8, n >>= 8;
|
| - if (n >> 4)
|
| - log2 += 4, n >>= 4;
|
| - if (n >> 2)
|
| - log2 += 2, n >>= 2;
|
| - if (n >> 1)
|
| - log2++;
|
| + PRIntn log2;
|
| + PR_CEILING_LOG2(log2, n);
|
| return log2;
|
| }
|
|
|
| @@ -65,17 +53,7 @@
|
| */
|
| PR_IMPLEMENT(PRIntn) PR_FloorLog2(PRUint32 n)
|
| {
|
| - PRIntn log2 = 0;
|
| -
|
| - if (n >> 16)
|
| - log2 += 16, n >>= 16;
|
| - if (n >> 8)
|
| - log2 += 8, n >>= 8;
|
| - if (n >> 4)
|
| - log2 += 4, n >>= 4;
|
| - if (n >> 2)
|
| - log2 += 2, n >>= 2;
|
| - if (n >> 1)
|
| - log2++;
|
| + PRIntn log2;
|
| + PR_FLOOR_LOG2(log2, n);
|
| return log2;
|
| }
|
|
|