Messages in this thread | | | Date | Thu, 15 Jan 2004 08:15:33 -0800 | From | Andrew Morton <> | Subject | Re: seperator error in __mask_snprintf_len |
| |
Paul Jackson <pj@sgi.com> wrote: > > Ok - here is a patch that should fix lib/mask.c displaying and parsing > cpumasks for 64 bit big endian architectures.
Gad.
> + * This layout of masks is determined by the macros in bitops.h, > + * which pre-date masks. The bitop operations were formalized > + * before the mask data type to which they apply.
So why not simply iterate across it with test_bit()?
val = 0; for (bit = maskbytes * 8; bit >= 0; bit--) { val <<= 1; if (__test_bit(maskp, bit)) val |= 1; if ((bit & 15) == 15) { sprintf(buf, "%x", val); buf++; val = 0; } }
(plus bounds checking, null-termination, etc)? It is hardly performance-critical.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |