return 如何在 C 中实际返回?

Mas*_*ash 1 c bit-manipulation return bit

DAT_1001b50C 是一个数字,我正在对它进行位移。现在我对以下行有疑问:

return DAT_1001b50C >> 0x10 & 0x7fff;

这条线会回来吗

DAT_1001b50C >> 0x10
and
DAT_1001b50C >> 0x7fff
Run Code Online (Sandbox Code Playgroud)

或者这会回来吗

(DAT_1001b50C >> 0x10) >> 0x7fff
Run Code Online (Sandbox Code Playgroud)

Eri*_*hil 6

两者都不。DAT_1001b50C >> 0x10 & 0x7fff(DAT_1001b50C >> 0x10) & 0x7fff。这将DAT_1001b50C右移 16 位的值并与 执行按位与0x7fff,从而保留低 15 位并清除其余位。