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_BITS_H_ | 5 #ifndef V8_BASE_BITS_H_ |
6 #define V8_BASE_BITS_H_ | 6 #define V8_BASE_BITS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include "src/base/macros.h" | 9 #include "src/base/macros.h" |
10 #if V8_CC_MSVC | 10 #if V8_CC_MSVC |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return rhs ? lhs / rhs : 0u; | 231 return rhs ? lhs / rhs : 0u; |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 // UnsignedMod32(lhs, rhs) divides |lhs| by |rhs| and returns the remainder | 235 // UnsignedMod32(lhs, rhs) divides |lhs| by |rhs| and returns the remainder |
236 // truncated to uint32. If |rhs| is zero, then zero is returned. | 236 // truncated to uint32. If |rhs| is zero, then zero is returned. |
237 inline uint32_t UnsignedMod32(uint32_t lhs, uint32_t rhs) { | 237 inline uint32_t UnsignedMod32(uint32_t lhs, uint32_t rhs) { |
238 return rhs ? lhs % rhs : 0u; | 238 return rhs ? lhs % rhs : 0u; |
239 } | 239 } |
240 | 240 |
| 241 |
| 242 // InsertElement64(val, elm, off) returns |val| with the 32 bits at |off| |
| 243 // replaced by |elm|. |off| must be either 0 or 1. |
| 244 uint64_t InsertElement64(uint64_t val, uint32_t elm, uint8_t off); |
| 245 |
241 } // namespace bits | 246 } // namespace bits |
242 } // namespace base | 247 } // namespace base |
243 } // namespace v8 | 248 } // namespace v8 |
244 | 249 |
245 #endif // V8_BASE_BITS_H_ | 250 #endif // V8_BASE_BITS_H_ |
OLD | NEW |