Ch17 - Extended Precision: lshift problem
ylme opened this issue · 0 comments
ylme commented
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;