diff --git a/crc32.s b/crc32.s index 8192223..de1c3ed 100644 --- a/crc32.s +++ b/crc32.s @@ -127,6 +127,14 @@ iloop2: #............................................ +.macro notw rd, rs + not \rd, \rs + #zext.w \rd, \rd + #add.uw \rd, \rs, 0 + slli \rd, \rd, 32 + srli \rd, \rd, 32 +.endm + # inputs: # a0: crc # a1: buf @@ -142,9 +150,7 @@ crc_update: mv t2, s1 mv t3, s2 # invert crc - li t0, -1 - srli t0, t0, 32 - xor a0, a0, t0 + notw a0, a0 mv s0, a0 # crc mv s1, a1 # buffer @@ -174,6 +180,5 @@ udone: # invert crc #li t0, -1 #srli t0, t0, 32 - li t0, 0xFFFFFFFF - xor a0, a0, t0 + notw a0, a0 ret