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

Side by Side Diff: src/base/bits.cc

Issue 528993002: First step to cleanup the power-of-2 mess. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: clang-format Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/base/bits.h ('k') | src/base/bits-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/base/bits.h"
6 #include "src/base/logging.h"
7
8 namespace v8 {
9 namespace base {
10 namespace bits {
11
12 uint32_t RoundUpToPowerOfTwo32(uint32_t value) {
13 DCHECK_LE(value, 0x80000000u);
14 value = value - 1;
15 value = value | (value >> 1);
16 value = value | (value >> 2);
17 value = value | (value >> 4);
18 value = value | (value >> 8);
19 value = value | (value >> 16);
20 return value + 1;
21 }
22
23 } // namespace bits
24 } // namespace base
25 } // namespace v8
OLDNEW
« no previous file with comments | « src/base/bits.h ('k') | src/base/bits-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698