我正在尝试将整数的高24-32字节存储到char指针地址,即
stb r9 0(r30)
,在 C 中,您不需要对存储进行编程 - 这是底层汇编器实现的工作。但如果你说你需要将 32 位变量
var
的高 8 位保存到指针p
中存储的某个地址,那么这只是普通位掩码的工作
*p = (var & 0xFF000000);
/*
*p dereference p, i.e., do this to the address stored in p
= assign the value on the right to what is on the
left (i.e., the reference to the address stored in p)
var & 0xFF000000 Take the bit-wise AND of the value in `var` and 0xFF000000
*/