Re:Nearly All Binary Searches and Mergesorts are Broken (2006)
by pbsd on Friday July 10, 2015 @02:21AM
(#9862542)
I 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).
[0] http://docs.oracle.com/cd/E19620-01/805-4693/instructionset-...