我熟悉这样访问的多维数组: arr[rows][cols] 当我将其想象为网格或坐标系并定位点时,这对我来说很有意义。但我对下面的行感到困惑。我知道它正在获取一个指向位于结构数组中的某个结构的指针我只是很难想象这可以代表哪个位置根据我习惯的坐标系......顺便说一下它是一个位图和某物是一个像素。
//what does this line mean SOMETHING *o = original + row*cols + col;
for (row=0; row < rows; row++)
for (col=0; col < cols; col++) {
SOMETHING* o = original + row*cols + col;
SOMETHING* n = (*new) + row*cols + (cols-1-col);
*n = *o;
}
Run Code Online (Sandbox Code Playgroud) 接下来是几个在线文档但当我尝试打印我存储在寄存器%ecx中的数字时,没有任何反应.这可能是因为我基本上执行计算然后尝试在循环中打印?
mov $48, %ecx #Convert to ascii
mov $1, %edx #Print Byte
add %eax, %ecx
mov $4, %eax #Output To Console
mov $1, %ebx #File Descriptor - Standardout
int $0x80 #Call the Kernel
Run Code Online (Sandbox Code Playgroud) 我正在使用32位系统并在EDX中保存了64位数:EAX.我正在尝试减去ESI中保存的数字:EDI是正确的吗?我很确定它不是因为经过3次迭代后结果不正确.
sub %esi, %edx #Subtract two 64 bit numbers
sub %edi, %eax
Run Code Online (Sandbox Code Playgroud)