Chameleon

Chameleon Svn Source Tree

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

Source at commit 1146 created 12 years 10 months ago.
By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing).
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: 1146