Re: seperator error in __mask_snprintf_len
From: Andrew Morton
Date: Thu Jan 15 2004 - 11:17:20 EST
Paul Jackson <pj@xxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/