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”中检索“face”?
int i = (id | (face << 16) | (type << 18))
谢谢!
你不会,除非你能保证它只有 2 位宽,而且id只有 16 位宽,在这种情况下,你所要做的就是右移和屏蔽。这是一个技巧问题吗?
id
因此,鉴于 id 仅 16 位宽且 face 仅 2 位宽的限制,请使用:
face = (i >> 16 ) & 3