| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_UTILS_H_ | 5 #ifndef V8_UTILS_H_ |
| 6 #define V8_UTILS_H_ | 6 #define V8_UTILS_H_ |
| 7 | 7 |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return (previous & ~kMask) | encode(value); | 223 return (previous & ~kMask) | encode(value); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Extracts the bit field from the value. | 226 // Extracts the bit field from the value. |
| 227 static T decode(U value) { | 227 static T decode(U value) { |
| 228 return static_cast<T>((value & kMask) >> shift); | 228 return static_cast<T>((value & kMask) >> shift); |
| 229 } | 229 } |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 | 232 |
| 233 template <class T, int shift, int size> |
| 234 class BitField8 : public BitFieldBase<T, shift, size, uint8_t> {}; |
| 235 |
| 236 |
| 237 template <class T, int shift, int size> |
| 238 class BitField16 : public BitFieldBase<T, shift, size, uint16_t> {}; |
| 239 |
| 240 |
| 233 template<class T, int shift, int size> | 241 template<class T, int shift, int size> |
| 234 class BitField : public BitFieldBase<T, shift, size, uint32_t> { }; | 242 class BitField : public BitFieldBase<T, shift, size, uint32_t> { }; |
| 235 | 243 |
| 236 | 244 |
| 237 template<class T, int shift, int size> | 245 template<class T, int shift, int size> |
| 238 class BitField64 : public BitFieldBase<T, shift, size, uint64_t> { }; | 246 class BitField64 : public BitFieldBase<T, shift, size, uint64_t> { }; |
| 239 | 247 |
| 240 | 248 |
| 241 // ---------------------------------------------------------------------------- | 249 // ---------------------------------------------------------------------------- |
| 242 // BitSetComputer is a help template for encoding and decoding information for | 250 // BitSetComputer is a help template for encoding and decoding information for |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 // Takes the address of the limit variable in order to find out where | 1537 // Takes the address of the limit variable in order to find out where |
| 1530 // the top of stack is right now. | 1538 // the top of stack is right now. |
| 1531 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); | 1539 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); |
| 1532 return limit; | 1540 return limit; |
| 1533 } | 1541 } |
| 1534 | 1542 |
| 1535 } // namespace internal | 1543 } // namespace internal |
| 1536 } // namespace v8 | 1544 } // namespace v8 |
| 1537 | 1545 |
| 1538 #endif // V8_UTILS_H_ | 1546 #endif // V8_UTILS_H_ |
| OLD | NEW |