我試着在C++中掩蓋一個地址。這是我試過的。如何在C++中使用位掩碼?
INT32 * myaddr = (INT32*)addr; // This converted 'addr' to the hexadecimal format -- 'myaddr'
現在我該如何and
它0xff00?
UINT32 sec_addr = (myaddr & 0xff);
當我嘗試做以下.. 這是錯誤我得到:
error: invalid operands of types ‘LEVEL_BASE::INT32*’ and ‘int’ to binary ‘operator&’
什麼是錯誤我在幹什麼?
錯誤在於''和'INT32 *''int' –
此外,0xff不等於0xff00而是0x00ff(可能它只是一個錯字問題) – Losiowaty