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

Side by Side Diff: runtime/platform/utils.cc

Issue 9209001: Move utils.h and utils.cc from runtime/vm to runtime/platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addresed new comments from ager@ Created 8 years, 11 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 | « runtime/platform/utils.h ('k') | runtime/vm/assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/utils.h" 5 #include "platform/utils.h"
6 6
7 namespace dart { 7 namespace dart {
8 8
9 // Implementation is from "Hacker's Delight" by Henry S. Warren, Jr., 9 // Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
10 // figure 3-3, page 48, where the function is called clp2. 10 // figure 3-3, page 48, where the function is called clp2.
11 uint32_t Utils::RoundUpToPowerOfTwo(uint32_t x) { 11 uint32_t Utils::RoundUpToPowerOfTwo(uint32_t x) {
12 x = x - 1; 12 x = x - 1;
13 x = x | (x >> 1); 13 x = x | (x >> 1);
14 x = x | (x >> 2); 14 x = x | (x >> 2);
15 x = x | (x >> 4); 15 x = x | (x >> 4);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 a = (a + 0x7ed55d16) + (a << 12); 82 a = (a + 0x7ed55d16) + (a << 12);
83 a = (a ^ 0xc761c23c) ^ (a >> 19); 83 a = (a ^ 0xc761c23c) ^ (a >> 19);
84 a = (a + 0x165667b1) + (a << 5); 84 a = (a + 0x165667b1) + (a << 5);
85 a = (a + 0xd3a2646c) ^ (a << 9); 85 a = (a + 0xd3a2646c) ^ (a << 9);
86 a = (a + 0xfd7046c5) + (a << 3); 86 a = (a + 0xfd7046c5) + (a << 3);
87 a = (a ^ 0xb55a4f09) ^ (a >> 16); 87 a = (a ^ 0xb55a4f09) ^ (a >> 16);
88 return static_cast<uint32_t>(a); 88 return static_cast<uint32_t>(a);
89 } 89 }
90 90
91 } // namespace dart 91 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/utils.h ('k') | runtime/vm/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698