1//===-- Unittests for ffsll -----------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "src/strings/ffsll.h"
10
11#include "src/__support/macros/config.h"
12#include "test/UnitTest/Test.h"
13
14namespace LIBC_NAMESPACE_DECL {
15
16TEST(LlvmLibcFfsllTest, SimpleFfsll) {
17 ASSERT_EQ(ffsll(0x0000000000000000LL), 0);
18 ASSERT_EQ(ffsll(0x0000000000000001LL), 1);
19 ASSERT_EQ(ffsll(0x0000000000000020LL), 6);
20 ASSERT_EQ(ffsll(0x0000000000000400LL), 11);
21 ASSERT_EQ(ffsll(0x0000000000008000LL), 16);
22 ASSERT_EQ(ffsll(0x0000000000010000LL), 17);
23 ASSERT_EQ(ffsll(0x0000000000200000LL), 22);
24 ASSERT_EQ(ffsll(0x0000000004000000LL), 27);
25 ASSERT_EQ(ffsll(0x0000000080000000LL), 32);
26 ASSERT_EQ(ffsll(0x0000000100000000LL), 33);
27 ASSERT_EQ(ffsll(0x0000002000000000LL), 38);
28 ASSERT_EQ(ffsll(0x0000040000000000LL), 43);
29 ASSERT_EQ(ffsll(0x0000800000000000LL), 48);
30 ASSERT_EQ(ffsll(0x0001000000000000LL), 49);
31 ASSERT_EQ(ffsll(0x0020000000000000LL), 54);
32 ASSERT_EQ(ffsll(0x0400000000000000LL), 59);
33 ASSERT_EQ(ffsll(0x8000000000000000LL), 64);
34 ASSERT_EQ(ffsll(0xfbe71LL), 1);
35 ASSERT_EQ(ffsll(0xfbe70LL), 5);
36 ASSERT_EQ(ffsll(0x10LL), 5);
37 ASSERT_EQ(ffsll(0x100LL), 9);
38}
39
40} // namespace LIBC_NAMESPACE_DECL
41

source code of libc/test/src/strings/ffsll_test.cpp