Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/libgcc/__clzsi2.c
Parent Directory
|
Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 402 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 402 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | /* |
2 | * libgcc/__clzsi2.c |
3 | * |
4 | * Returns the leading number of 0 bits in the argument |
5 | */ |
6 | |
7 | #include <stdint.h> |
8 | #include <stddef.h> |
9 | |
10 | uint32_t __clzsi2(uint32_t v) |
11 | { |
12 | int p = 31; |
13 | |
14 | if (v & 0xffff0000) { |
15 | p -= 16; |
16 | v >>= 16; |
17 | } |
18 | if (v & 0xff00) { |
19 | p -= 8; |
20 | v >>= 8; |
21 | } |
22 | if (v & 0xf0) { |
23 | p -= 4; |
24 | v >>= 4; |
25 | } |
26 | if (v & 0xc) { |
27 | p -= 2; |
28 | v >>= 2; |
29 | } |
30 | if (v & 0x2) { |
31 | p -= 1; |
32 | v >>= 1; |
33 | } |
34 | |
35 | return p; |
36 | } |