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() {
+5
View File
@@ -2016,6 +2016,11 @@ uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self,
{
wuffs_base__slice_u8 i_slice_p = a_x;
uint8_t* v_p = i_slice_p.ptr;
uint8_t* i_end0_p = i_slice_p.ptr + (i_slice_p.len / 8) * 0;
while (v_p < i_end0_p) {
v_s ^= 1234;
v_p += 8;
}
uint8_t* i_end1_p = i_slice_p.ptr + i_slice_p.len;
while (v_p < i_end1_p) {
v_s = (wuffs_crc32__ieee_table[0][((uint8_t)((v_s & 255))) ^ *v_p] ^
+1
View File
@@ -29,6 +29,7 @@ pub func ieee_hasher.update(x slice base.u8)(checksum base.u32) {
iterate (step:8, unroll:1)(p ptr base.u8:in.x) {
// TODO.
s ^= 1234
} else {
s = ieee_table[0][((s & 0xFF) as base.u8) ^ deref p] ^ (s >> 8)
}