aboutsummaryrefslogtreecommitdiff
path: root/softfloat/s_countLeadingZeros32.c
blob: 0bd17e1f5b4df3b3fa4195e6885685935e09f960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

#include <stdint.h>
#include "primitives.h"

int softfloat_countLeadingZeros32( uint32_t a )
{
    int count;

    count = 0;
    if ( a < 0x10000 ) {
        count = 16;
        a <<= 16;
    }
    if ( a < 0x1000000 ) {
        count += 8;
        a <<= 8;
    }
    count += softfloat_countLeadingZeros8[ a>>24 ];
    return count;

}