Rename some generated iterate variables

This commit is contained in:
Nigel Tao committed 2018-05-04 13:44:55 +10:00
1 parent 81edda0413
commit a23681d1ba
3 files changed
+23 -20

No files matched your search

+17 -14
View File
@@ -243,7 +243,8 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
unroll := n.Unroll().SmallPowerOf2Value()
step := n.Step().SmallPowerOf2Value()
if uStep := unroll * step; uStep != 1 {
if uStep := unroll * step; uStep > 1 {
b.printf("%s%s.len = %d;\n", vPrefix, name, step)
b.printf("uint8_t* %send0_%s = %sslice_%s.ptr + (%sslice_%s.len / %d) * %d;\n",
iPrefix, name, iPrefix, name, iPrefix, name, uStep, uStep)
@@ -259,21 +260,23 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
b.writes("}\n")
}
b.printf("%s%s.len = %d;\n", vPrefix, name, 1)
b.printf("uint8_t* %send1_%s = %sslice_%s.ptr + %sslice_%s.len;\n",
iPrefix, name, iPrefix, name, iPrefix, name)
b.printf("while (%s%s.ptr < %send1_%s) {\n", vPrefix, name, iPrefix, name)
tail := n.Tail()
if step == 1 {
tail = n.Body()
}
for _, o := range tail {
if err := g.writeStatement(b, o, depth); err != nil {
return err
{
b.printf("%s%s.len = %d;\n", vPrefix, name, 1)
b.printf("uint8_t* %send2_%s = %sslice_%s.ptr + %sslice_%s.len;\n",
iPrefix, name, iPrefix, name, iPrefix, name)
b.printf("while (%s%s.ptr < %send2_%s) {\n", vPrefix, name, iPrefix, name)
tail := n.Tail()
if step == 1 {
tail = n.Body()
}
for _, o := range tail {
if err := g.writeStatement(b, o, depth); err != nil {
return err
}
}
b.printf("%s%s.ptr += 1;\n", vPrefix, name)
b.writes("}\n")
}
b.printf("%s%s.ptr++;\n", vPrefix, name)
b.writes("}\n")
b.writes("}\n")
return nil
+3 -3
View File
@@ -1693,11 +1693,11 @@ uint32_t wuffs_adler32__hasher__update(wuffs_adler32__hasher* self,
v_p.ptr += 1;
}
v_p.len = 1;
uint8_t* i_end1_p = i_slice_p.ptr + i_slice_p.len;
while (v_p.ptr < i_end1_p) {
uint8_t* i_end2_p = i_slice_p.ptr + i_slice_p.len;
while (v_p.ptr < i_end2_p) {
v_s1 += ((uint32_t)(v_p.ptr[0]));
v_s2 += v_s1;
v_p.ptr++;
v_p.ptr += 1;
}
}
v_s1 %= 65521;
+3 -3
View File
@@ -2033,11 +2033,11 @@ uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self,
v_p.ptr += 8;
}
v_p.len = 1;
uint8_t* i_end1_p = i_slice_p.ptr + i_slice_p.len;
while (v_p.ptr < i_end1_p) {
uint8_t* i_end2_p = i_slice_p.ptr + i_slice_p.len;
while (v_p.ptr < i_end2_p) {
v_s = (wuffs_crc32__ieee_table[0][((uint8_t)((v_s & 255))) ^ v_p.ptr[0]] ^
(v_s >> 8));
v_p.ptr++;
v_p.ptr += 1;
}
}
self->private_impl.f_state = (4294967295 ^ v_s);