Define MADV_REMOVE.
[glibc-ports.git] / sysdeps / i960 / ffs.c
blobad907a4ecbcd52783f2998b923a249d3146c5083
1 /* ffs -- find first set bit in a word, counted from least significant end.
2 For i960 Core architecture
3 This file is part of the GNU C Library.
4 Copyright (C) 1994, 1997, 2004 Free Software Foundation, Inc.
5 Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
6 On-Line Applications Research Corporation.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 02111-1307 USA. */
23 #include <string.h>
25 #undef ffs
27 #if defined (__GNUC__) && defined (__i960__)
29 int
30 __ffs (x)
31 int x;
33 int cnt;
35 asm ("scanbit %1,%0" : "=d" (cnt) : "rm" (x & -x));
37 return cnt;
39 weak_alias (__ffs, ffs)
40 libc_hidden_builtin_def (ffs)
42 #else
44 #include <sysdeps/generic/ffs.c>
46 #endif