给出以下代码:
.section .rodata
input_format: .string "%d"
output_format1: .string ""
output_format2: .string ""
.section .text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
.loop:
addl $-4 ,%esp # moving down the stack
pushl %esp
pushl $input_format
call scanf # call scanf to get a number from the user
addl $8,%esp
movl (%esp),%edx # get the new number
movl $0,%esi # reseting first mask
addl $0x1,%esi # first mask of 0x1
movl $0,%ecx # reseting second mask
addl $0x80000000,%ecx
// more code in the future
# return from printf:
movl %ebp,%esp
popl %ebp
ret
我正在尝试构建一个掩码,以便识别给定的数字是否是回文。
所以我想要掩码,首先在MSB中使用全0和“1”位,然后是另一个
在LSB中使用全零和“1”位,然后运行16次并使用AND比较结果。
但是,在撰写addl $0x80000000,%ecx
时,注册%ecx
将无法立即获得0x80000000
。那是为什么?
答案 0 :(得分:3)
什么是0x80000000 + 0x80000000?结果就是它似乎不起作用的原因。
无论如何设置高位,请使用位操作
orl $0x80000000, %ecx