[libc-commits] [libc] [libc] implement `strings/ffs` (PR #129892)

Connector Switch via libc-commits libc-commits at lists.llvm.org
Fri Mar 7 09:47:21 PST 2025


================
@@ -14,8 +14,23 @@
 namespace LIBC_NAMESPACE_DECL {
 
 TEST(LlvmLibcFfslTest, SimpleFfsl) {
-  ASSERT_EQ(ffsl(0L), 0);
-  ASSERT_EQ(ffsl(1L), 1);
+  ASSERT_EQ(ffsl(0x00000000L), 0);
+  ASSERT_EQ(ffsl(0x00000001L), 1);
+  ASSERT_EQ(ffsl(0x00000020L), 6);
+  ASSERT_EQ(ffsl(0x00000400L), 11);
+  ASSERT_EQ(ffsl(0x00008000L), 16);
+  ASSERT_EQ(ffsl(0x00010000L), 17);
+  ASSERT_EQ(ffsl(0x00200000L), 22);
+  ASSERT_EQ(ffsl(0x04000000L), 27);
+  ASSERT_EQ(ffsl(0x80000000L), 32);
+  ASSERT_EQ(ffsl(0x0000000100000000L), 33);
----------------
c8ef wrote:

Ah, I almost forgot about this. Thanks for reminding me!

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


More information about the libc-commits mailing list