lkml.org 
[lkml]   [2004]   [Jan]   [15]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 15 Jan 2004 08:15:33 -0800
FromAndrew Morton <>
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:00    [from the cache]
©2003-2008