Deleted Added
full compact
ffs.S (256281) ffs.S (271337)
1/* $NetBSD: ffs.S,v 1.5 2003/04/05 23:08:52 bjh21 Exp $ */
2/*
3 * Copyright (c) 2001 Christopher Gilbert
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <machine/asm.h>
32
1/* $NetBSD: ffs.S,v 1.5 2003/04/05 23:08:52 bjh21 Exp $ */
2/*
3 * Copyright (c) 2001 Christopher Gilbert
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <machine/asm.h>
32
33__FBSDID("$FreeBSD: stable/10/lib/libc/arm/string/ffs.S 172616 2007-10-13 12:06:31Z cognet $");
33__FBSDID("$FreeBSD: stable/10/lib/libc/arm/string/ffs.S 271337 2014-09-09 22:24:01Z ian $");
34
35/*
36 * ffs - find first set bit, this algorithm isolates the first set
37 * bit, then multiplies the number by 0x0450fbaf which leaves the top
38 * 6 bits as an index into the table. This algorithm should be a win
39 * over the checking each bit in turn as per the C compiled version.
40 *
41 * under ARMv5 there's an instruction called CLZ (count leading Zero's) that

--- 33 unchanged lines hidden (view full) ---

75 .byte 10, 0, 0, 25, 0, 0, 21, 27 /* 40-47 */
76 .byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */
77 .byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */
78#else
79 clzne r0, r0
80 rsbne r0, r0, #32
81 RET
82#endif
34
35/*
36 * ffs - find first set bit, this algorithm isolates the first set
37 * bit, then multiplies the number by 0x0450fbaf which leaves the top
38 * 6 bits as an index into the table. This algorithm should be a win
39 * over the checking each bit in turn as per the C compiled version.
40 *
41 * under ARMv5 there's an instruction called CLZ (count leading Zero's) that

--- 33 unchanged lines hidden (view full) ---

75 .byte 10, 0, 0, 25, 0, 0, 21, 27 /* 40-47 */
76 .byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */
77 .byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */
78#else
79 clzne r0, r0
80 rsbne r0, r0, #32
81 RET
82#endif
83END(ffs)