3 ms·
Not directly available in C, but wouldn't RCR[0] fix this appropriately on X86 at least? [0] http://docs.oracle.com/cd/E19620-01/805-4693/instructionset-117/in
by bkin 11y ago
Not directly available in C, but wouldn't RCR[0] fix this appropriately on X86 at least?
[0] http://docs.oracle.com/cd/E19620-01/805-4693/instructionset-117/index.html http://docs.oracle.com/cd/E19620-01/805-4693/instructionset-...
- pbsd 11y agoI suppose it would. However, RCR is a notoriously slow microcoded instruction in modern x86. You'd be better off with something like add rax, rbx ; lo + hi setc cl shrd rax, rcx, 1 Or, better, the generic way to do it without carries: ((a ^ b) >> 1) + (a & b).