| 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 RUNTIME_PLATFORM_UTILS_H_ | 5 #ifndef RUNTIME_PLATFORM_UTILS_H_ |
| 6 #define RUNTIME_PLATFORM_UTILS_H_ | 6 #define RUNTIME_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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 return ((b > 0) && (a > (kMaxInt64 - b))) || | 177 return ((b > 0) && (a > (kMaxInt64 - b))) || |
| 178 ((b < 0) && (a < (kMinInt64 - b))); | 178 ((b < 0) && (a < (kMinInt64 - b))); |
| 179 } | 179 } |
| 180 | 180 |
| 181 static inline bool WillSubOverflow(int64_t a, int64_t b) { | 181 static inline bool WillSubOverflow(int64_t a, int64_t b) { |
| 182 return ((b > 0) && (a < (kMinInt64 + b))) || | 182 return ((b > 0) && (a < (kMinInt64 + b))) || |
| 183 ((b < 0) && (a > (kMaxInt64 + b))); | 183 ((b < 0) && (a > (kMaxInt64 + b))); |
| 184 } | 184 } |
| 185 | 185 |
| 186 | 186 |
| 187 // Utility functions for converting values from host endianess to | 187 // Utility functions for converting values from host endianness to |
| 188 // big or little endian values. | 188 // big or little endian values. |
| 189 static uint16_t HostToBigEndian16(uint16_t host_value); | 189 static uint16_t HostToBigEndian16(uint16_t host_value); |
| 190 static uint32_t HostToBigEndian32(uint32_t host_value); | 190 static uint32_t HostToBigEndian32(uint32_t host_value); |
| 191 static uint64_t HostToBigEndian64(uint64_t host_value); | 191 static uint64_t HostToBigEndian64(uint64_t host_value); |
| 192 static uint16_t HostToLittleEndian16(uint16_t host_value); | 192 static uint16_t HostToLittleEndian16(uint16_t host_value); |
| 193 static uint32_t HostToLittleEndian32(uint32_t host_value); | 193 static uint32_t HostToLittleEndian32(uint32_t host_value); |
| 194 static uint64_t HostToLittleEndian64(uint64_t host_value); | 194 static uint64_t HostToLittleEndian64(uint64_t host_value); |
| 195 | 195 |
| 196 static bool DoublesBitEqual(const double a, const double b) { | 196 static bool DoublesBitEqual(const double a, const double b) { |
| 197 return bit_cast<int64_t, double>(a) == bit_cast<int64_t, double>(b); | 197 return bit_cast<int64_t, double>(a) == bit_cast<int64_t, double>(b); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 216 #include "platform/utils_linux.h" | 216 #include "platform/utils_linux.h" |
| 217 #elif defined(HOST_OS_MACOS) | 217 #elif defined(HOST_OS_MACOS) |
| 218 #include "platform/utils_macos.h" | 218 #include "platform/utils_macos.h" |
| 219 #elif defined(HOST_OS_WINDOWS) | 219 #elif defined(HOST_OS_WINDOWS) |
| 220 #include "platform/utils_win.h" | 220 #include "platform/utils_win.h" |
| 221 #else | 221 #else |
| 222 #error Unknown target os. | 222 #error Unknown target os. |
| 223 #endif | 223 #endif |
| 224 | 224 |
| 225 #endif // RUNTIME_PLATFORM_UTILS_H_ | 225 #endif // RUNTIME_PLATFORM_UTILS_H_ |
| OLD | NEW |