mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 00:47:56 +01:00
Fill more of std/gif's copy_to_image_buffer
This commit is contained in:
1 parent
11a8ebf1ee
commit
3df370e82c
3 files changed
+109
-26
No files matched your search
+12
-11
@@ -1084,8 +1084,18 @@ func (q *checker) bcheckExprBinaryOp1(op t.ID, lhs *a.Expr, lMin *big.Int, lMax
|
||||
}
|
||||
return big.NewInt(0).Mul(lMin, rMin), big.NewInt(0).Mul(lMax, rMax), nil
|
||||
|
||||
case t.IDXBinarySlash:
|
||||
// TODO.
|
||||
case t.IDXBinarySlash, t.IDXBinaryPercent:
|
||||
// Prohibit division by zero.
|
||||
if lMin.Sign() < 0 {
|
||||
return nil, nil, fmt.Errorf("check: divide/modulus op argument %q is possibly negative", lhs.Str(q.tm))
|
||||
}
|
||||
if rMin.Sign() <= 0 {
|
||||
return nil, nil, fmt.Errorf("check: divide/modulus op argument %q is possibly non-positive", rhs.Str(q.tm))
|
||||
}
|
||||
if op == t.IDXBinarySlash {
|
||||
return big.NewInt(0).Mul(lMin, rMax), big.NewInt(0).Mul(lMax, rMin), nil
|
||||
}
|
||||
return zero, big.NewInt(0).Sub(rMax, one), nil
|
||||
|
||||
case t.IDXBinaryShiftL:
|
||||
if lMin.Sign() < 0 {
|
||||
@@ -1141,15 +1151,6 @@ func (q *checker) bcheckExprBinaryOp1(op t.ID, lhs *a.Expr, lMin *big.Int, lMax
|
||||
// conservative, but works fine in practice.
|
||||
return zero, bitMask(z.BitLen()), nil
|
||||
|
||||
case t.IDXBinaryPercent:
|
||||
if lMin.Sign() < 0 {
|
||||
return nil, nil, fmt.Errorf("check: modulus op argument %q is possibly negative", lhs.Str(q.tm))
|
||||
}
|
||||
if rMin.Sign() <= 0 {
|
||||
return nil, nil, fmt.Errorf("check: modulus op argument %q is possibly non-positive", rhs.Str(q.tm))
|
||||
}
|
||||
return zero, big.NewInt(0).Sub(rMax, one), nil
|
||||
|
||||
case t.IDXBinaryTildeModPlus, t.IDXBinaryTildeModMinus:
|
||||
typ := lhs.MType()
|
||||
if typ.IsIdeal() {
|
||||
|
||||
Reference in new issue
Block a user