* Differences in bitops argument types
@ 2007-11-01 22:23 Jan Kara
2007-11-02 4:59 ` Paul Mackerras
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2007-11-01 22:23 UTC (permalink / raw)
To: linux-kernel
Hello,
I've just found out that operations like constant_test_bit() take pointer
of different types on different architectures. In particular, x86_64,
blackfin and frv take void * while i386, s390 and m68k take unsigned long
*. Is this intended difference? Wouldn't using void * everywhere be more
appropriate? Thanks for answer in advance.
Honza
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Differences in bitops argument types
2007-11-01 22:23 Differences in bitops argument types Jan Kara
@ 2007-11-02 4:59 ` Paul Mackerras
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mackerras @ 2007-11-02 4:59 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-kernel
Jan Kara writes:
> I've just found out that operations like constant_test_bit() take pointer
> of different types on different architectures. In particular, x86_64,
> blackfin and frv take void * while i386, s390 and m68k take unsigned long
> *. Is this intended difference? Wouldn't using void * everywhere be more
> appropriate? Thanks for answer in advance.
A bitmap is defined to be an array of unsigned longs. Using an array
of a smaller or longer type will give different results on big-endian
architectures. Therefore using unsigned long * is better, because it
finds errors where callers are using an array of some other type.
Paul.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-02 5:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-01 22:23 Differences in bitops argument types Jan Kara
2007-11-02 4:59 ` Paul Mackerras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox