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

Side by Side Diff: src/base/macros.h

Issue 2565743002: Switch to std::is_fundamental<>. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/list-inl.h » ('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 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_BASE_MACROS_H_ 5 #ifndef V8_BASE_MACROS_H_
6 #define V8_BASE_MACROS_H_ 6 #define V8_BASE_MACROS_H_
7 7
8 #include "src/base/compiler-specific.h" 8 #include "src/base/compiler-specific.h"
9 #include "src/base/format-macros.h" 9 #include "src/base/format-macros.h"
10 #include "src/base/logging.h" 10 #include "src/base/logging.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return AddressFrom<T>(OffsetFrom(x) & -m); 275 return AddressFrom<T>(OffsetFrom(x) & -m);
276 } 276 }
277 277
278 278
279 // Return the smallest multiple of m which is >= x. 279 // Return the smallest multiple of m which is >= x.
280 template <typename T> 280 template <typename T>
281 inline T RoundUp(T x, intptr_t m) { 281 inline T RoundUp(T x, intptr_t m) {
282 return RoundDown<T>(static_cast<T>(x + m - 1), m); 282 return RoundDown<T>(static_cast<T>(x + m - 1), m);
283 } 283 }
284 284
285
286 namespace v8 {
287 namespace base {
288
289 // TODO(yangguo): This is a poor man's replacement for std::is_fundamental,
290 // which requires C++11. Switch to std::is_fundamental once possible.
291 template <typename T>
292 inline bool is_fundamental() {
293 return false;
294 }
295
296 template <>
297 inline bool is_fundamental<uint8_t>() {
298 return true;
299 }
300
301 } // namespace base
302 } // namespace v8
303
304 #endif // V8_BASE_MACROS_H_ 285 #endif // V8_BASE_MACROS_H_
OLDNEW
« no previous file with comments | « no previous file | src/list-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698