implemented p_sort_*

Added merge-sort algorithm. p_sort_allthreads was faster than
p_sort_hwthreads (70 ms in my test), but that may vary. To specify the
number of threads, use p_sort_nthreads