Re: format_cpumask()

Luck, Tony
2003-11-17T18:49:41Z

> + for (k = sizeof(cpumask_t)/sizeof(long) - 1; k >= 0; ++k) {
> + int m;
> + cpumask_t tmp;
> +
> + cpus_shift_right(tmp, cpus, BITS_PER_LONG*k);
> + if (BITS_PER_LONG == 32)
> + m = sprintf(buf, "%08lx", cpus_coerce(tmp));
> + else /* BITS_PER_LONG == 64 */
> + m = sprintf(buf, "%16lx", cpus_coerce(tmp));
> + len += m;
> + buf += m;
> + }

That makes it had to write portable shell scripts (etc.) that can
parse these values on both 32-bit and 64-bit systems? A bitmask with
just cpu0 set looks like:

0000000100000000

on a 32-bit machine. And like:

0000000000000001

on a 64-bit machine. Heaven help the architectures (ia64, sparc, ppc)
that support both 32-bit and 64-bit applications!

-Tony Luck