OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [libmem/] [tests/] [clz.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
 
2
#include <l4/macros.h>
3
#include <l4/types.h>
4
#include <l4/config.h>
5
 
6
/* Emulation of CLZ (count leading zeroes) instruction */
7
unsigned int __clz(unsigned int bitvector)
8
{
9
        unsigned int x = 0;
10
        while((!(bitvector & ((unsigned)1 << 31))) && (x < 32)) {
11
                bitvector <<= 1;
12
                x++;
13
        }
14
        return x;
15
}
16
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.