Skip to content

Commit e6d697b

Browse files
authored
Merge pull request #9 from sql-hkr/fix/#3
Fix branch instruction in bubblesort example
2 parents 7bb45a4 + 7e2fabc commit e6d697b

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ inner_loop:
126126
ld r24, r22 ; r24 = B
127127
; compare A and B (we'll swap if A < B)
128128
cp r21, r24 ; sets carry if r21 < r24
129-
brcs no_swap
129+
brcc no_swap
130130
; swap A and B: store B into A's address, A into B's address
131131
st r20, r24
132132
st r22, r21

docs/examples/bubblesort.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ This example demonstrates a simple bubble sort algorithm implemented in assembly
5757
ld r24, r22 ; r24 = B
5858
; compare A and B (we'll swap if A < B)
5959
cp r21, r24 ; sets carry if r21 < r24
60-
brcs no_swap
60+
brcc no_swap
6161
; swap A and B: store B into A's address, A into B's address
6262
st r20, r24
6363
st r22, r21

examples/bubblesort.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ inner_loop:
4646
ld r24, r22 ; r24 = B
4747
; compare A and B (we'll swap if A < B)
4848
cp r21, r24 ; sets carry if r21 < r24
49-
brcs no_swap
49+
brcc no_swap
5050
; swap A and B: store B into A's address, A into B's address
5151
st r20, r24
5252
st r22, r21

0 commit comments

Comments
 (0)