mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add ffs(3), ffsl(3), and ffsll(3).
This commit is contained in:
parent
6ea9a0d509
commit
fdbcea19dc
5 changed files with 96 additions and 0 deletions
|
@ -98,6 +98,9 @@ stdlib/strtof.o \
|
|||
stdlib/strtold.o \
|
||||
stdlib/wcstombs.o \
|
||||
stdlib/wctomb.o \
|
||||
string/ffsll.o \
|
||||
string/ffsl.o \
|
||||
string/ffs.o \
|
||||
string/memccpy.o \
|
||||
string/memchr.o \
|
||||
string/memcmp.o \
|
||||
|
|
|
@ -34,6 +34,9 @@ __BEGIN_DECLS
|
|||
@include(size_t.h)
|
||||
@include(locale_t.h)
|
||||
|
||||
int ffs(int);
|
||||
int ffsl(long int);
|
||||
int ffsll(long long int);
|
||||
void* memccpy(void* __restrict, const void* __restrict, int, size_t);
|
||||
void* memchr(const void*, int, size_t);
|
||||
int memcmp(const void*, const void*, size_t);
|
||||
|
|
30
libc/string/ffs.cpp
Normal file
30
libc/string/ffs.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
string/ffs.cpp
|
||||
Returns the index of the first set bit.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern "C" int ffs(int val)
|
||||
{
|
||||
return __builtin_ffs(val);
|
||||
}
|
30
libc/string/ffsl.cpp
Normal file
30
libc/string/ffsl.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
string/ffsl.cpp
|
||||
Returns the index of the first set bit.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern "C" int ffsl(long int val)
|
||||
{
|
||||
return __builtin_ffsl(val);
|
||||
}
|
30
libc/string/ffsll.cpp
Normal file
30
libc/string/ffsll.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
string/ffsll.cpp
|
||||
Returns the index of the first set bit.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern "C" int ffsll(long long int val)
|
||||
{
|
||||
return __builtin_ffsll(val);
|
||||
}
|
Loading…
Add table
Reference in a new issue