Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-10-09 01:03:40 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-10-09 01:03:40 +0400
commitd326f841c3c9e9927d5ac56efc202ce7f80a66d1 (patch)
tree0dd00f29df1f545d37bc4f854c38acb252abfcfd /winsup/cygwin
parent2fb56bbfaa9f6cc2787bb1f50a666bf65e7d227a (diff)
* common.din (ffsl): Export.
(ffsll): Export. * syscalls.cc (ffs): Implement using GCC intrinsic. (ffsl): Ditto. (ffsll): Ditto. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/common.din2
-rw-r--r--winsup/cygwin/include/cygwin/version.h3
-rw-r--r--winsup/cygwin/syscalls.cc29
3 files changed, 17 insertions, 17 deletions
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index bf20fde7a..1268f83b1 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -374,6 +374,8 @@ feupdateenv SIGFE
fexecve SIGFE
fflush SIGFE
ffs NOSIGFE
+ffsl NOSIGFE
+ffsll NOSIGFE
fgetc SIGFE
fgetpos SIGFE
fgets SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index e0ec40dc4..a5c482da9 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -451,12 +451,13 @@ details. */
275: Introduce account mapping from Windows account DBs. Add CW_SETENT,
CW_GETENT, CW_ENDENT, CW_GETNSSSEP, CW_GETPWSID, CW_GETGRSID,
CW_CYGNAME_FROM_WINNAME.
+ 276: Export ffsl, ffsll.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 275
+#define CYGWIN_VERSION_API_MINOR 276
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 044e0036a..933bfe464 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3836,22 +3836,19 @@ nice (int incr)
extern "C" int
ffs (int i)
{
- static const unsigned char table[] =
- {
- 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
- };
- unsigned x = i & -i;
-
- int a = x <= 0xffff ? (x <= 0xff ? 0 : 8) : (x <= 0xffffff ? 16 : 24);
-
- return table[x >> a] + a;
+ return __builtin_ffs (i);
+}
+
+extern "C" int
+ffsl (long i)
+{
+ return __builtin_ffsl (i);
+}
+
+extern "C" int
+ffsll (long long i)
+{
+ return __builtin_ffsll (i);
}
static void