POSIX: add ffsl and ffsll from musl sources.
appeared in issue 8: https://pubs.opengroup.org/onlinepubs/9799919799/functions/ffs.html Change-Id: Ic382498c3e2d6138aedbeb88578882457ee875ee Reviewed-on: https://review.haiku-os.org/c/haiku/+/9836 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
11d8ab2a71
commit
b739532218
@@ -14,7 +14,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static __inline__ int ffs(int i) { return __builtin_ffs(i); }
|
||||
extern int ffs(int i);
|
||||
extern int ffsl(long i);
|
||||
extern int ffsll(long long i);
|
||||
|
||||
extern int strcasecmp(const char *string1, const char *string2);
|
||||
extern int strncasecmp(const char *string1, const char *string2,
|
||||
|
||||
@@ -28,18 +28,6 @@ static __inline int imin(int a, int b) { return (a < b ? a : b); }
|
||||
extern int abs(int a);
|
||||
|
||||
|
||||
static __inline __pure2 int
|
||||
ffsl(long mask)
|
||||
{
|
||||
return (__builtin_ffsl((u_long)mask));
|
||||
}
|
||||
|
||||
static __inline __pure2 int
|
||||
ffsll(long long mask)
|
||||
{
|
||||
return (__builtin_ffsll((unsigned long long)mask));
|
||||
}
|
||||
|
||||
static __inline __pure2 int
|
||||
fls(int mask)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,8 @@ SEARCH_SOURCE += [ FDirName $(posixSources) musl string ] ;
|
||||
|
||||
local muslSources =
|
||||
ffs.c
|
||||
ffsl.c
|
||||
ffsll.c
|
||||
rand.c
|
||||
rand_r.c
|
||||
;
|
||||
|
||||
@@ -14,6 +14,8 @@ for architectureObject in [ MultiArchSubDirSetup ] {
|
||||
basename.c
|
||||
dirname.c
|
||||
ffs.c
|
||||
ffsl.c
|
||||
ffsll.c
|
||||
ftw.c
|
||||
getsubopt.c
|
||||
nftw.c
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <strings.h>
|
||||
#include "atomic.h"
|
||||
|
||||
int ffs(int i);
|
||||
int ffs(int i)
|
||||
{
|
||||
return i ? a_ctz_l(i)+1 : 0;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <strings.h>
|
||||
#include "atomic.h"
|
||||
|
||||
int ffsl(long i)
|
||||
{
|
||||
return i ? a_ctz_l(i)+1 : 0;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <strings.h>
|
||||
#include "atomic.h"
|
||||
|
||||
int ffsll(long long i)
|
||||
{
|
||||
return i ? a_ctz_64(i)+1 : 0;
|
||||
}
|
||||
Reference in New Issue
Block a user