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 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 *(reinterpret_cast<V*>(p)) = value; | 1745 *(reinterpret_cast<V*>(p)) = value; |
1746 #else // V8_TARGET_ARCH_MIPS | 1746 #else // V8_TARGET_ARCH_MIPS |
1747 memmove(p, &value, sizeof(V)); | 1747 memmove(p, &value, sizeof(V)); |
1748 #endif // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 1748 #endif // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1749 } | 1749 } |
1750 | 1750 |
1751 static inline double ReadDoubleValue(const void* p) { | 1751 static inline double ReadDoubleValue(const void* p) { |
1752 return ReadUnalignedValue<double>(p); | 1752 return ReadUnalignedValue<double>(p); |
1753 } | 1753 } |
1754 | 1754 |
1755 | |
1756 static inline void WriteDoubleValue(void* p, double value) { | 1755 static inline void WriteDoubleValue(void* p, double value) { |
1757 WriteUnalignedValue(p, value); | 1756 WriteUnalignedValue(p, value); |
1758 } | 1757 } |
1759 | 1758 |
1760 | |
1761 static inline uint16_t ReadUnalignedUInt16(const void* p) { | 1759 static inline uint16_t ReadUnalignedUInt16(const void* p) { |
1762 return ReadUnalignedValue<uint16_t>(p); | 1760 return ReadUnalignedValue<uint16_t>(p); |
1763 } | 1761 } |
1764 | 1762 |
1765 | |
1766 static inline void WriteUnalignedUInt16(void* p, uint16_t value) { | 1763 static inline void WriteUnalignedUInt16(void* p, uint16_t value) { |
1767 WriteUnalignedValue(p, value); | 1764 WriteUnalignedValue(p, value); |
1768 } | 1765 } |
1769 | 1766 |
| 1767 static inline uint32_t ReadUnalignedUInt32(const void* p) { |
| 1768 return ReadUnalignedValue<uint32_t>(p); |
| 1769 } |
| 1770 |
1770 static inline void WriteUnalignedUInt32(void* p, uint32_t value) { | 1771 static inline void WriteUnalignedUInt32(void* p, uint32_t value) { |
1771 WriteUnalignedValue(p, value); | 1772 WriteUnalignedValue(p, value); |
1772 } | 1773 } |
1773 | 1774 |
1774 } // namespace internal | 1775 } // namespace internal |
1775 } // namespace v8 | 1776 } // namespace v8 |
1776 | 1777 |
1777 #endif // V8_UTILS_H_ | 1778 #endif // V8_UTILS_H_ |
OLD | NEW |