Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PLATFORM_UTILS_H_ | 5 #ifndef PLATFORM_UTILS_H_ |
| 6 #define PLATFORM_UTILS_H_ | 6 #define PLATFORM_UTILS_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
| 10 | 10 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Utility functions for converting values from host endianess to | 174 // Utility functions for converting values from host endianess to |
| 175 // big or little endian values. | 175 // big or little endian values. |
| 176 static uint16_t HostToBigEndian16(uint16_t host_value); | 176 static uint16_t HostToBigEndian16(uint16_t host_value); |
| 177 static uint32_t HostToBigEndian32(uint32_t host_value); | 177 static uint32_t HostToBigEndian32(uint32_t host_value); |
| 178 static uint64_t HostToBigEndian64(uint64_t host_value); | 178 static uint64_t HostToBigEndian64(uint64_t host_value); |
| 179 static uint16_t HostToLittleEndian16(uint16_t host_value); | 179 static uint16_t HostToLittleEndian16(uint16_t host_value); |
| 180 static uint32_t HostToLittleEndian32(uint32_t host_value); | 180 static uint32_t HostToLittleEndian32(uint32_t host_value); |
| 181 static uint64_t HostToLittleEndian64(uint64_t host_value); | 181 static uint64_t HostToLittleEndian64(uint64_t host_value); |
| 182 | |
| 183 static bool DoublesBitEqual(const double a, const double b) { | |
| 184 const int64_t* a_i = reinterpret_cast<const int64_t*>(&a); | |
|
zra
2014/05/02 23:19:08
bit_cast<int64_t, double>(a) is what we've been us
srdjan
2014/05/02 23:33:47
Done.
| |
| 185 const int64_t* b_i = reinterpret_cast<const int64_t*>(&b); | |
| 186 return (*a_i == *b_i); | |
| 187 } | |
| 182 }; | 188 }; |
| 183 | 189 |
| 184 } // namespace dart | 190 } // namespace dart |
| 185 | 191 |
| 186 #if defined(TARGET_OS_ANDROID) | 192 #if defined(TARGET_OS_ANDROID) |
| 187 #include "platform/utils_android.h" | 193 #include "platform/utils_android.h" |
| 188 #elif defined(TARGET_OS_LINUX) | 194 #elif defined(TARGET_OS_LINUX) |
| 189 #include "platform/utils_linux.h" | 195 #include "platform/utils_linux.h" |
| 190 #elif defined(TARGET_OS_MACOS) | 196 #elif defined(TARGET_OS_MACOS) |
| 191 #include "platform/utils_macos.h" | 197 #include "platform/utils_macos.h" |
| 192 #elif defined(TARGET_OS_WINDOWS) | 198 #elif defined(TARGET_OS_WINDOWS) |
| 193 #include "platform/utils_win.h" | 199 #include "platform/utils_win.h" |
| 194 #else | 200 #else |
| 195 #error Unknown target os. | 201 #error Unknown target os. |
| 196 #endif | 202 #endif |
| 197 | 203 |
| 198 #endif // PLATFORM_UTILS_H_ | 204 #endif // PLATFORM_UTILS_H_ |
| OLD | NEW |