Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
「i」から「顔」を取得するにはどうすればよいですか?
int i = (id | (face << 16) | (type << 18))
ありがとう!
幅が 2 ビットのみであり、幅が 16 ビットのみであることを保証できない限り、そうする必要はありません。idその場合、必要なのは右シフトとマスクだけです。これはひっかけ問題ですか?
id
したがって、id の幅は 16 ビットのみで、face の幅は 2 ビットのみであるという制限がある場合は、次のように使用します。
face = (i >> 16 ) & 3