libsmc icon indicating copy to clipboard operation
libsmc copied to clipboard

Incorrect from_fpe2 conversion

Open yackx opened this issue 6 years ago • 0 comments

I believe a shift sign has been inverted rendering the conversion incorrect.

static unsigned int from_fpe2(uint8_t data[32])
{
    unsigned int ans = 0;
    
    // Data type for fan calls - fpe2
    // This is assumend to mean floating point, with 2 exponent bits
    // http://stackoverflow.com/questions/22160746/fpe2-and-sp78-data-types
    ans += data[0] << 6;
    ans += data[1] << 2;

    return ans;
}

Should be:

    ans += data[1] >> 2;

(+ typo "assumend" -> "assumed")

Can do a tiny PR if it helps.

yackx avatar Aug 21 '18 17:08 yackx