| Index: runtime/platform/globals.h
|
| diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
|
| index a18bc8764edef5aefb9fd13b31045cec54d3c514..30491f2e9626cb958efa79ba29086509fb4aba60 100644
|
| --- a/runtime/platform/globals.h
|
| +++ b/runtime/platform/globals.h
|
| @@ -663,6 +663,8 @@ inline D bit_copy(const S& source) {
|
| }
|
|
|
|
|
| +#if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) || \
|
| + defined(HOST_ARCH_ARM64)
|
| // Similar to bit_copy and bit_cast, but does take the type from the argument.
|
| template <typename T>
|
| static inline T ReadUnaligned(const T* ptr) {
|
| @@ -672,6 +674,27 @@ static inline T ReadUnaligned(const T* ptr) {
|
| }
|
|
|
|
|
| +// Similar to bit_copy and bit_cast, but does take the type from the argument.
|
| +template <typename T>
|
| +static inline void StoreUnaligned(T* ptr, T value) {
|
| + memcpy(ptr, &value, sizeof(value));
|
| +}
|
| +#else // !(HOST_ARCH_ARM || HOST_ARCH_MIPS || HOST_ARCH_ARM64)
|
| +// Similar to bit_copy and bit_cast, but does take the type from the argument.
|
| +template <typename T>
|
| +static inline T ReadUnaligned(const T* ptr) {
|
| + return *ptr;
|
| +}
|
| +
|
| +
|
| +// Similar to bit_copy and bit_cast, but does take the type from the argument.
|
| +template <typename T>
|
| +static inline void StoreUnaligned(T* ptr, T value) {
|
| + *ptr = value;
|
| +}
|
| +#endif // !(HOST_ARCH_ARM || HOST_ARCH_MIPS || HOST_ARCH_ARM64)
|
| +
|
| +
|
| // On Windows the reentrent version of strtok is called
|
| // strtok_s. Unify on the posix name strtok_r.
|
| #if defined(HOST_OS_WINDOWS)
|
|
|