Skip to content

Ch17 - Extended Precision: lshift problem #14

Description

@ylme

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions