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

Ch17 - Extended Precision: lshift problem #14

Open
ylme opened this issue Nov 4, 2019 · 0 comments
Open

Ch17 - Extended Precision: lshift problem #14

ylme opened this issue Nov 4, 2019 · 0 comments

Comments

@ylme
Copy link

ylme commented Nov 4, 2019

https://github.com/drh/cii/blob/master/src/xp.c#L192

should change to if (n >= m + s/8)

For example {0xFF, 0xFF} shift left XP_lshift(3, z, 2, x, 20, 0) should be {0, 0, 0} , but is {0, 0xFF, 0xFF}.

Fix:

int i, j = n-1;
if (n >= m + s/8)
    //  +++------+++ m
    // ============= n
    i = m - 1;
else
    // +++------+++ m
    //      ======= n < m + s/8
    //        ===== n < m
    i = n - s/8 - 1;
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