Index: runtime/platform/utils_fuchsia.h |
diff --git a/runtime/platform/utils_fuchsia.h b/runtime/platform/utils_fuchsia.h |
index 705422587974855b16149d441460869dd6b08558..a44fcb8b4869e17a43485bf5671cfbece9343122 100644 |
--- a/runtime/platform/utils_fuchsia.h |
+++ b/runtime/platform/utils_fuchsia.h |
@@ -10,14 +10,24 @@ |
namespace dart { |
inline int Utils::CountLeadingZeros(uword x) { |
- UNIMPLEMENTED(); |
- return 0; |
+#if defined(ARCH_IS_32_BIT) |
+ return __builtin_clzl(x); |
+#elif defined(ARCH_IS_64_BIT) |
+ return __builtin_clzll(x); |
+#else |
+#error Architecture is not 32-bit or 64-bit. |
+#endif |
} |
inline int Utils::CountTrailingZeros(uword x) { |
- UNIMPLEMENTED(); |
- return 0; |
+#if defined(ARCH_IS_32_BIT) |
+ return __builtin_ctzl(x); |
+#elif defined(ARCH_IS_64_BIT) |
+ return __builtin_ctzll(x); |
+#else |
+#error Architecture is not 32-bit or 64-bit. |
+#endif |
} |