Skip to content

Instantly share code, notes, and snippets.

@buismaarten
Created March 28, 2022 16:59
Show Gist options
  • Save buismaarten/1992585ee196ff091cc395bf5643c104 to your computer and use it in GitHub Desktop.
Save buismaarten/1992585ee196ff091cc395bf5643c104 to your computer and use it in GitHub Desktop.
.global __aeabi_uidiv
__aeabi_uidiv:
cmp r1, #0
mov r2, r0
beq .L8
mov r3, #1
blt .L3
.L4:
lsls r1, r1, #1
lsl r3, r3, #1
bpl .L4
cmp r3, #0
beq .L15
.L3:
mov r0, #0
.L7:
cmp r1, r2
lsl r0, r0, #1
subls r2, r2, r1
addls r0, r0, #1
lsrs r3, r3, #1
lsr r1, r1, #1
bne .L7
bx lr
.L8:
mov r0, r1
bx lr
.L15:
mov r0, r3
bx lr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment