[libc-commits] [libc] [libc] implement stdc_leading_ones (C23) (PR #80082)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Jan 31 15:52:05 PST 2024


================
@@ -0,0 +1,20 @@
+//===-- Implementation of stdc_leading_ones_ui ----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/stdbit/stdc_leading_ones_ui.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(unsigned, stdc_leading_ones_ui, (unsigned value)) {
+  return cpp::countl_one(value);
----------------
nickdesaulniers wrote:

done in 58b63c0ec8f4

https://github.com/llvm/llvm-project/pull/80082


More information about the libc-commits mailing list