Portable core nums

Review by @dolio or @ekmett, please?