I am trying to call isdigit, and to do so I need first byte of my buffer, which is defined as following.
...
.equ ARRAYSIZE, 20
.section ".bss"
buffer:
.skip ARRAYSIZE
...
input:
pushl $buffer
pushl $scanFormat
call scanf
addl $8, %esp
Thus, buffer is allocated a memory space of 20 byte and I put some value using scanf, as shown in input.
Now I want to access the first 4 bytes in order to call isdigit. How can I access them?
My initial guess is to use movl buffer, %eax, since eax register is 4 byte-size, and will store the first 4 bytes in buffer. But I am not sure this is how it works.
Please let me know if I can only access the first 4 bytes of buffer, or any other methods to apply isdigit to those first 4 bytes. Thank you.
.section .bsswouldn't have quotes around".bss". I'm not sure that even works.isdigitis locale-aware, but if you can assume that the current locale's only "digit" characters are'0' .. '9'then it's much more efficient to manually check withsub $'0', %al/cmp $10, %al/jae not_a_digit