mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
std/jpeg: call slice.bulk_memset
This commit is contained in:
1 parent
5edfe45e15
commit
2f18dc61d0
8 files changed
+160
-91
No files matched your search
@@ -838,6 +838,33 @@ func (n *TypeExpr) Pointee() *TypeExpr {
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *TypeExpr) BulkSize() *big.Int {
|
||||
if !n.IsBulkNumType() {
|
||||
return nil
|
||||
}
|
||||
ret := big.NewInt(1)
|
||||
for ; n.id0 == t.IDArray; n = n.rhs.AsTypeExpr() {
|
||||
ret = ret.Mul(ret, n.ArrayLength().ConstValue())
|
||||
}
|
||||
switch n.id2 {
|
||||
case t.IDU8:
|
||||
return ret
|
||||
case t.IDU16:
|
||||
return ret.Lsh(ret, 1)
|
||||
case t.IDU32:
|
||||
return ret.Lsh(ret, 2)
|
||||
case t.IDU64:
|
||||
return ret.Lsh(ret, 3)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *TypeExpr) IsBulkNumType() bool {
|
||||
for ; n.id0 == t.IDArray; n = n.rhs.AsTypeExpr() {
|
||||
}
|
||||
return n.id0 == 0 && n.id1 == t.IDBase && n.id2.IsNumType()
|
||||
}
|
||||
|
||||
func (n *TypeExpr) IsBool() bool {
|
||||
return n.id0 == 0 && n.id1 == t.IDBase && n.id2 == t.IDBool
|
||||
}
|
||||
@@ -914,6 +941,10 @@ func (n *TypeExpr) IsReadOnly() bool {
|
||||
return (n.id0 == t.IDRoarray) || (n.id0 == t.IDRoslice) || (n.id0 == t.IDRotable)
|
||||
}
|
||||
|
||||
func (n *TypeExpr) IsContainerOfSpecificNumType(container t.ID, numType t.ID) bool {
|
||||
return (n.id0 == container) && n.Inner().IsNumType() && (n.Inner().id2 == numType)
|
||||
}
|
||||
|
||||
func (n *TypeExpr) IsUnsignedInteger() bool {
|
||||
return n.id0 == 0 && n.id1 == t.IDBase &&
|
||||
(n.id2 == t.IDU8 || n.id2 == t.IDU16 || n.id2 == t.IDU32 || n.id2 == t.IDU64)
|
||||
|
||||
Reference in new issue
Block a user