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.
我有一个 64 位内存值,前 16 位是偏移量,将 16 位添加到其他 48 位的最有效方法是什么。显而易见的逻辑是
ab = *ptr >> 48 result = *ptr & 0x0000 ffff ffff ffff + ab;
如果它是 20/44 位,那会是什么。
SIMD / Asm 的答案很好。
我也可以在最后存储偏移量,仅供参考,主要值将是对象地址,偏移量是对象的偏移量。将这些位放在开头允许收集器使用寄存器来屏蔽它,但它可以更好地优化 mutator。