cross-platform cpu count

also added assert_range test helper.
Fixes nv_get_cpu_count on OSX.