Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/modules/klibc/__clzsi2.c

Source at commit 728 created 13 years 3 months ago.
By meklort, Updated Symbols.dylib generation. Module linked list rework beginning. USB Legacy off patch still needs fixing. Added a new tool to generate the symbols.dylib. It's a fairly correct dylib file, however nm complains about it (it still works fine though). Updated Symbols.dylib file is smaller (~13%) that the old method and is a bit cleaner. dylib generation needs a bit of cleaning up though)
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
10uint32_t __clzsi2(uint32_t v)
11{
12int p = 31;
13
14if (v & 0xffff0000) {
15p -= 16;
16v >>= 16;
17}
18if (v & 0xff00) {
19p -= 8;
20v >>= 8;
21}
22if (v & 0xf0) {
23p -= 4;
24v >>= 4;
25}
26if (v & 0xc) {
27p -= 2;
28v >>= 2;
29}
30if (v & 0x2) {
31p -= 1;
32v >>= 1;
33}
34
35return p;
36}
37

Archive Download this file

Revision: 728