factored out cross-platform array_sort into sort.c: extended value example