[Fractdev] shift by negative bits

Top Page
Delete this message
Reply to this message
Author: Richard
Date:  
To: fractdev
Subject: [Fractdev] shift by negative bits
in unix/fpu087.c, RegSftFloat:

    long RegSftFloat(x, Shift)
    long x;
    int Shift;
    {
        float f;
        f = em2float(x);
        if (Shift>0) {
        f *= (1<<Shift);
        } else {
        f /= (1<<Shift);
        }
        return float2em(f);
    }

When Shift is negative, it divides by 1 left-shifted by a negative
number of bits. Shouldn't this be 1 << -Shift instead?
-- 
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
      <http://www.xmission.com/~legalize/book/download/index.html>


Legalize Adulthood! <http://blogs.xmission.com/legalize/>