161 views
0 votes
0 votes

What is the following function doing?
 

unsigned fun(unsigned int a)
{
    unsigned int i, x = 0, y = 0, z = 0;
    for(i = 0; i < 16; i++)
    {
        y <<= 2;
        y += !!(a & 0x80000000) << 1;
        y += !!(a & 0x40000000);
        a <<= 2;
        x = x + (x&1);
        x <<= 1;
        z <<= 1;
        if(x + 1 <= y)
        {
            x++;
            z++;
            y-=x;
        }
    }
    return z;
}

 

Please log in or register to answer this question.

No related questions found