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 "include/v8stdint.h" | 8 #include "include/v8stdint.h" |
9 | 9 |
10 | 10 |
(...skipping 91 matching lines...) Loading... |
102 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED | 102 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED |
103 | 103 |
104 #endif | 104 #endif |
105 | 105 |
106 | 106 |
107 // The USE(x) template is used to silence C++ compiler warnings | 107 // The USE(x) template is used to silence C++ compiler warnings |
108 // issued for (yet) unused variables (typically parameters). | 108 // issued for (yet) unused variables (typically parameters). |
109 template <typename T> | 109 template <typename T> |
110 inline void USE(T) { } | 110 inline void USE(T) { } |
111 | 111 |
| 112 |
| 113 #define IS_POWER_OF_TWO(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) |
| 114 |
| 115 // The following macro works on both 32 and 64-bit platforms. |
| 116 // Usage: instead of writing 0x1234567890123456 |
| 117 // write V8_2PART_UINT64_C(0x12345678,90123456); |
| 118 #define V8_2PART_UINT64_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u)) |
| 119 |
112 #endif // V8_BASE_MACROS_H_ | 120 #endif // V8_BASE_MACROS_H_ |
OLD | NEW |