From 1735b80e24cebc4a0949429c3cf3909ccab61cf1 Mon Sep 17 00:00:00 2001 From: dwrz Date: Thu, 22 Oct 2026 14:14:59 +0000 Subject: [PATCH] Add fizzbuzz operand size suffixes --- fizzbuzz/fizzbuzz.s | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fizzbuzz/fizzbuzz.s b/fizzbuzz/fizzbuzz.s index 366bb37..9d866db 100644 --- a/fizzbuzz/fizzbuzz.s +++ b/fizzbuzz/fizzbuzz.s @@ -51,7 +51,7 @@ test_fizz: div %rbx cmp $0, %rdx # Was the remainder 0? jne test_buzz # If not, test division by 5. - add $1, 8(%rsp) # Otherwise, increment the print case. + addq $1, 8(%rsp) # Otherwise, increment the print case. test_buzz: mov 24(%rsp), %rax # Retrieve the counter again. movq $5, %rbx # Use 5 as the divisor for "buzz" test. @@ -59,7 +59,7 @@ test_buzz: div %rbx cmp $0, %rdx # Was the remainder 0? jne return_print_case # If not, return. - add $2, 8(%rsp) # Otherwise, increment the print case by two. + addq $2, 8(%rsp) # Otherwise, increment the print case by two. return_print_case: mov 8(%rsp), %rax # Put the print case in %rax. mov %rbp, %rsp @@ -136,13 +136,13 @@ _print: # %rcx will hold the address of the buffer to be printed. # %rdx will hold the number of bytes to write. # How these are set depends on the print case: - cmp $0, 16(%rsp) + cmpq $0, 16(%rsp) je print_counter - cmp $1, 16(%rsp) + cmpq $1, 16(%rsp) je print_fizz - cmp $2, 16(%rsp) + cmpq $2, 16(%rsp) je print_buzz - cmp $3, 16(%rsp) + cmpq $3, 16(%rsp) je print_fizzbuzz print_counter: # We need to convert the counter to ASCII.