x86, apic: refactor ->cpu_mask_to_apicid*()