(Replying to PARENT post)

    buffer_num += (elements[i] < pivot);
Is this really branchless though? I'm curious what the generated assembler code looks like.
๐Ÿ‘คcodeflo๐Ÿ•‘9y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

It is. You can use the `setl` instruction to conditionally set a register depending on whether the previous `cmp` was less. Then, you simply do an `add` with the produced value, which is either 0 or 1.

EDIT: You can see this here https://godbolt.org/g/ssy4am

๐Ÿ‘คlooki๐Ÿ•‘9y๐Ÿ”ผ0๐Ÿ—จ๏ธ0