File tree Expand file tree Collapse file tree 14 files changed +318
-0
lines changed Expand file tree Collapse file tree 14 files changed +318
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ set(TARGET_LIBC_ENTRYPOINTS
93
93
libc.src.strings.bcmp
94
94
libc.src.strings.bcopy
95
95
libc.src.strings.bzero
96
+ libc.src.strings.ffs
97
+ libc.src.strings.ffsl
98
+ libc.src.strings.ffsll
96
99
libc.src.strings.index
97
100
libc.src.strings.rindex
98
101
libc.src.strings.strcasecmp
Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ set(TARGET_LIBC_ENTRYPOINTS
93
93
libc.src.strings.bcmp
94
94
libc.src.strings.bcopy
95
95
libc.src.strings.bzero
96
+ libc.src.strings.ffs
97
+ libc.src.strings.ffsl
98
+ libc.src.strings.ffsll
96
99
libc.src.strings.index
97
100
libc.src.strings.rindex
98
101
libc.src.strings.strcasecmp
Original file line number Diff line number Diff line change @@ -29,6 +29,24 @@ functions:
29
29
arguments :
30
30
- type : void *
31
31
- type : size_t
32
+ - name : ffs
33
+ standards :
34
+ - POSIX
35
+ return_type : int
36
+ arguments :
37
+ - type : int
38
+ - name : ffsl
39
+ standards :
40
+ - POSIX
41
+ return_type : int
42
+ arguments :
43
+ - type : long
44
+ - name : ffsll
45
+ standards :
46
+ - POSIX
47
+ return_type : int
48
+ arguments :
49
+ - type : long long
32
50
- name : index
33
51
standards :
34
52
- BSDExtensions
Original file line number Diff line number Diff line change @@ -54,6 +54,36 @@ add_entrypoint_object(
54
54
bcopy.h
55
55
)
56
56
57
+ add_entrypoint_object (
58
+ ffs
59
+ SRCS
60
+ ffs.cpp
61
+ HDRS
62
+ ffs.h
63
+ DEPENDS
64
+ libc.src.__support.math_extras
65
+ )
66
+
67
+ add_entrypoint_object (
68
+ ffsl
69
+ SRCS
70
+ ffsl.cpp
71
+ HDRS
72
+ ffsl.h
73
+ DEPENDS
74
+ libc.src.__support.math_extras
75
+ )
76
+
77
+ add_entrypoint_object (
78
+ ffsll
79
+ SRCS
80
+ ffsll.cpp
81
+ HDRS
82
+ ffsll.h
83
+ DEPENDS
84
+ libc.src.__support.math_extras
85
+ )
86
+
57
87
add_entrypoint_object (
58
88
index
59
89
SRCS
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation of ffs ---------------------------------------------===//
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/ffs.h"
10
+ #include " src/__support/common.h"
11
+ #include " src/__support/macros/config.h"
12
+ #include " src/__support/math_extras.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ LLVM_LIBC_FUNCTION (int , ffs, (int i)) {
17
+ return first_trailing_one (static_cast <unsigned >(i));
18
+ }
19
+
20
+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for ffs ---------------------------*- C++ -*-===//
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
+ #ifndef LLVM_LIBC_SRC_STRINGS_FFS_H
10
+ #define LLVM_LIBC_SRC_STRINGS_FFS_H
11
+
12
+ #include " src/__support/macros/config.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ int ffs (int i);
17
+
18
+ } // namespace LIBC_NAMESPACE_DECL
19
+
20
+ #endif // LLVM_LIBC_SRC_STRINGS_FFS_H
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation of ffsl --------------------------------------------===//
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/ffsl.h"
10
+ #include " src/__support/common.h"
11
+ #include " src/__support/macros/config.h"
12
+ #include " src/__support/math_extras.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ LLVM_LIBC_FUNCTION (int , ffsl, (long i)) {
17
+ return first_trailing_one (static_cast <unsigned long >(i));
18
+ }
19
+
20
+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for ffsl --------------------------*- C++ -*-===//
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
+ #ifndef LLVM_LIBC_SRC_STRINGS_FFSL_H
10
+ #define LLVM_LIBC_SRC_STRINGS_FFSL_H
11
+
12
+ #include " src/__support/macros/config.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ int ffsl (long i);
17
+
18
+ } // namespace LIBC_NAMESPACE_DECL
19
+
20
+ #endif // LLVM_LIBC_SRC_STRINGS_FFSL_H
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation of 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
+ #include " src/__support/common.h"
11
+ #include " src/__support/macros/config.h"
12
+ #include " src/__support/math_extras.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ LLVM_LIBC_FUNCTION (int , ffsll, (long long i)) {
17
+ return first_trailing_one (static_cast <unsigned long long >(i));
18
+ }
19
+
20
+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for ffsll -------------------------*- C++ -*-===//
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
+ #ifndef LLVM_LIBC_SRC_STRINGS_FFSLL_H
10
+ #define LLVM_LIBC_SRC_STRINGS_FFSLL_H
11
+
12
+ #include " src/__support/macros/config.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ int ffsll (long long i);
17
+
18
+ } // namespace LIBC_NAMESPACE_DECL
19
+
20
+ #endif // LLVM_LIBC_SRC_STRINGS_FFSLL_H
You can’t perform that action at this time.
0 commit comments