Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect from_fpe2 conversion #10

Open
yackx opened this issue Aug 21, 2018 · 0 comments
Open

Incorrect from_fpe2 conversion #10

yackx opened this issue Aug 21, 2018 · 0 comments

Comments

@yackx
Copy link

yackx commented Aug 21, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant