Generate placeholders for an iterate step:8 body

This commit is contained in:
Nigel Tao committed 2018-05-04 09:18:44 +10:00
1 parent c511c53b1f
commit 33746151aa
3 files changed
+14 -3

No files matched your search

+8 -3
View File
@@ -243,10 +243,15 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
unroll := n.Unroll().SmallPowerOf2Value()
step := n.Step().SmallPowerOf2Value()
// TODO: remove the "step == 1" hack.
if uStep := unroll * step; uStep != 1 && step == 1 {
if uStep := unroll * step; uStep != 1 {
// TODO: remove this hack.
hack := 1
if step != 1 {
hack = 0
}
b.printf("uint8_t* %send0_%s = %sslice_%s.ptr + (%sslice_%s.len / %d) * %d;\n",
iPrefix, name, iPrefix, name, iPrefix, name, uStep, uStep)
iPrefix, name, iPrefix, name, iPrefix, name, uStep, uStep*hack)
b.printf("while (%s%s < %send0_%s) {\n", vPrefix, name, iPrefix, name)
for i := 0; i < unroll; i++ {
for _, o := range n.Body() {