News for hackers. Stuff that matters.
Re:Nearly All Binary Searches and Mergesorts are Broken (2006) by bkin on Thursday July 09, 2015 @03:46PM (#9860243)
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-...

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).