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

Unified Diff: base/bits.h

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 5 years 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
« no previous file with comments | « base/bind_unittest.nc ('k') | base/bits_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bits.h
diff --git a/base/bits.h b/base/bits.h
index 505d2c8f75d901688186ed2e1f981b3a9a2562bc..a3a59d1dfad0d4c2992b1a6d0abd9a0c4fc2b1aa 100644
--- a/base/bits.h
+++ b/base/bits.h
@@ -7,21 +7,23 @@
#ifndef BASE_BITS_H_
#define BASE_BITS_H_
-#include "base/basictypes.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include "base/logging.h"
namespace base {
namespace bits {
// Returns the integer i such as 2^i <= n < 2^(i+1)
-inline int Log2Floor(uint32 n) {
+inline int Log2Floor(uint32_t n) {
if (n == 0)
return -1;
int log = 0;
- uint32 value = n;
+ uint32_t value = n;
for (int i = 4; i >= 0; --i) {
int shift = (1 << i);
- uint32 x = value >> shift;
+ uint32_t x = value >> shift;
if (x != 0) {
value = x;
log += shift;
@@ -32,7 +34,7 @@ inline int Log2Floor(uint32 n) {
}
// Returns the integer i such as 2^(i-1) < n <= 2^i
-inline int Log2Ceiling(uint32 n) {
+inline int Log2Ceiling(uint32_t n) {
if (n == 0) {
return -1;
} else {
« no previous file with comments | « base/bind_unittest.nc ('k') | base/bits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698