Using the same srai trick we can also have a six-instruction generic CRC without having flipped bits beforehand. I don't think we need this, though, given all our CRCs can be specialized. If we're short on space we can do it though.
// a0 current bit/temp, a3 running, t0 polynomial
c.xor a0, a3
c.slli a0, 31
c.srai a0, 31
// Depending on alignment needed these next two instructions can be flipped.
c.srli a3, 1
and a0, a0, t0
//
c.xor a3, a0
Mentioned by
@wChris_
on YouTube. Saves a compressed instruction.Using the same
srai
trick we can also have a six-instruction generic CRC without having flipped bits beforehand. I don't think we need this, though, given all our CRCs can be specialized. If we're short on space we can do it though.