| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA_H_ | 5 #ifndef PLATFORM_UTILS_FUCHSIA_H_ |
| 6 #define PLATFORM_UTILS_FUCHSIA_H_ | 6 #define PLATFORM_UTILS_FUCHSIA_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 inline int Utils::CountLeadingZeros(uword x) { | 12 inline int Utils::CountLeadingZeros(uword x) { |
| 13 UNIMPLEMENTED(); | 13 #if defined(ARCH_IS_32_BIT) |
| 14 return 0; | 14 return __builtin_clzl(x); |
| 15 #elif defined(ARCH_IS_64_BIT) |
| 16 return __builtin_clzll(x); |
| 17 #else |
| 18 #error Architecture is not 32-bit or 64-bit. |
| 19 #endif |
| 15 } | 20 } |
| 16 | 21 |
| 17 | 22 |
| 18 inline int Utils::CountTrailingZeros(uword x) { | 23 inline int Utils::CountTrailingZeros(uword x) { |
| 19 UNIMPLEMENTED(); | 24 #if defined(ARCH_IS_32_BIT) |
| 20 return 0; | 25 return __builtin_ctzl(x); |
| 26 #elif defined(ARCH_IS_64_BIT) |
| 27 return __builtin_ctzll(x); |
| 28 #else |
| 29 #error Architecture is not 32-bit or 64-bit. |
| 30 #endif |
| 21 } | 31 } |
| 22 | 32 |
| 23 | 33 |
| 24 inline uint16_t Utils::HostToBigEndian16(uint16_t value) { | 34 inline uint16_t Utils::HostToBigEndian16(uint16_t value) { |
| 25 UNIMPLEMENTED(); | 35 UNIMPLEMENTED(); |
| 26 return 0; | 36 return 0; |
| 27 } | 37 } |
| 28 | 38 |
| 29 | 39 |
| 30 inline uint32_t Utils::HostToBigEndian32(uint32_t value) { | 40 inline uint32_t Utils::HostToBigEndian32(uint32_t value) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 58 | 68 |
| 59 | 69 |
| 60 inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { | 70 inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { |
| 61 UNIMPLEMENTED(); | 71 UNIMPLEMENTED(); |
| 62 return NULL; | 72 return NULL; |
| 63 } | 73 } |
| 64 | 74 |
| 65 } // namespace dart | 75 } // namespace dart |
| 66 | 76 |
| 67 #endif // PLATFORM_UTILS_FUCHSIA_H_ | 77 #endif // PLATFORM_UTILS_FUCHSIA_H_ |
| OLD | NEW |