Add slice uintptr_low_12_bits method

This commit is contained in:
Nigel Tao committed 2021-02-13 17:19:35 +11:00
1 parent 0834b40d22
commit 81ba41e251
6 files changed
+42 -20

No files matched your search

+8
View File
@@ -687,6 +687,14 @@ func (g *gen) writeBuiltinSlice(b *buffer, recv *a.Expr, method t.ID, args []*a.
b.writes(".len))")
return nil
case t.IDUintptrLow12Bits:
b.writes("((uint32_t)(0xFFF & (uintptr_t)(")
if err := g.writeExpr(b, recv, false, depth); err != nil {
return err
}
b.writes(".ptr)))")
return nil
case t.IDSuffix:
// TODO: don't assume that the slice is a slice of base.u8.
b.writes("wuffs_base__slice_u8__suffix(")