Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Unified Diff: nss/mozilla/nsprpub/pr/src/misc/prlog2.c

Issue 3135002: Update to NSS 3.12.7 and NSPR 4.8.6.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698