it's not difficult to swap the pivot with the last element and have the compiler figure out it can keep pivot in register most of the time.
Here is an implementation. This should work with all types. Unfortunate I had to annotate with restrict, but a small price to pay.