mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 16:47:28 +01:00
cgen: simplify 1-elem in-case-of-recursion arrays
This commit is contained in:
1 parent
df1d4f64e2
commit
2c2bb9baa5
6 files changed
+1025
-1034
No files matched your search
@@ -1247,8 +1247,7 @@ func (g *gen) writeBuiltinQuestionCall(b *buffer, n *a.Expr, depth uint32) error
|
||||
}
|
||||
|
||||
g.currFunk.usesScratch = true
|
||||
// TODO: don't hard-code [0], and allow recursive coroutines.
|
||||
scratchName := fmt.Sprintf("self->private_data.%s%s[0].scratch",
|
||||
scratchName := fmt.Sprintf("self->private_data.%s%s.scratch",
|
||||
sPrefix, g.currFunk.astFunc.FuncName().Str(g.tm))
|
||||
|
||||
b.printf("%s = ", scratchName)
|
||||
@@ -1285,8 +1284,7 @@ func (g *gen) writeBuiltinQuestionCall(b *buffer, n *a.Expr, depth uint32) error
|
||||
switch method.Ident() {
|
||||
case t.IDWriteU8:
|
||||
g.currFunk.usesScratch = true
|
||||
// TODO: don't hard-code [0], and allow recursive coroutines.
|
||||
scratchName := fmt.Sprintf("self->private_data.%s%s[0].scratch",
|
||||
scratchName := fmt.Sprintf("self->private_data.%s%s.scratch",
|
||||
sPrefix, g.currFunk.astFunc.FuncName().Str(g.tm))
|
||||
|
||||
b.printf("%s = ", scratchName)
|
||||
@@ -1338,8 +1336,7 @@ func (g *gen) writeReadUxxAsUyy(b *buffer, n *a.Expr, preName string, xx uint8,
|
||||
}
|
||||
|
||||
g.currFunk.usesScratch = true
|
||||
// TODO: don't hard-code [0], and allow recursive coroutines.
|
||||
scratchName := fmt.Sprintf("self->private_data.%s%s[0].scratch",
|
||||
scratchName := fmt.Sprintf("self->private_data.%s%s.scratch",
|
||||
sPrefix, g.currFunk.astFunc.FuncName().Str(g.tm))
|
||||
|
||||
b.printf("if (WUFFS_BASE__LIKELY(io2_%s - iop_%s >= %d)) {\n", recvName, recvName, xx/8)
|
||||
|
||||
Reference in new issue
Block a user