aboutsummaryrefslogtreecommitdiff
path: root/misc/crc.s
blob: 03c0ce29c66adcfc3602fd85dcdf17e09a65ac04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.syntax unified
.cpu cortex-m0plus
.thumb

.type CRC32, %function
.global CRC32

// R0 = input addr
// R1 = length
CRC32:  LDR R5, =0x04C11DB7
        LDR R4, =0xFFFFFFFF
10:     LDR R2, [R0]
        REV R2, R2;
        EORS R4, R2
        MOVS R3, 32
20:     LSLS R4, 1
        BCC 30f
        EORS R4, R5
30:     SUBS R3, 1
        BNE 20b
        ADDS R0, 4
        SUBS R1, 1
        BNE 10b
        BX LR