OLD | NEW |
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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return AddressFrom<T>(OffsetFrom(x) & -m); | 391 return AddressFrom<T>(OffsetFrom(x) & -m); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 // Return the smallest multiple of m which is >= x. | 395 // Return the smallest multiple of m which is >= x. |
396 template <typename T> | 396 template <typename T> |
397 inline T RoundUp(T x, intptr_t m) { | 397 inline T RoundUp(T x, intptr_t m) { |
398 return RoundDown<T>(static_cast<T>(x + m - 1), m); | 398 return RoundDown<T>(static_cast<T>(x + m - 1), m); |
399 } | 399 } |
400 | 400 |
| 401 |
| 402 namespace v8 { |
| 403 namespace base { |
| 404 |
| 405 // TODO(yangguo): This is a poor man's replacement for std::is_fundamental, |
| 406 // which requires C++11. Switch to std::is_fundamental once possible. |
| 407 template <typename T> |
| 408 inline bool is_fundamental() { |
| 409 return false; |
| 410 } |
| 411 |
| 412 template <> |
| 413 inline bool is_fundamental<uint8_t>() { |
| 414 return true; |
| 415 } |
| 416 } |
| 417 } // namespace v8::base |
| 418 |
401 #endif // V8_BASE_MACROS_H_ | 419 #endif // V8_BASE_MACROS_H_ |
OLD | NEW |