Re: use bit field or kernel *_bit()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-03-01 at 15:29 +0100, Arjan van de Ven wrote:
> > 
> > one more question, for bit field, if we use long xyz:n, will that be an
> > issue in 32/64bit arch? i feel no, just to make sure.
> 
> first of all, you almost always want to make the bitfield an "unsigned"
> type; either "unsigned int" or "unsigned long". (there are exceptions to
> this, but if you need them you should ask yourself if you really really
> want bitfields in that case)

why unsigned int will have difference from signed int? i always access
it by bits right?

> 
> I'm not sure it matters much, but I suspect that as long as your fields
> aren't bigger than 32 bits, you should go for "unsigned int". This gives
> the compiler more freedom to deal with them...
> 

what if i need more than 32bits?

also for *_bit stuff, i remember somewhere states that i need to claim a
unsigned long and only safely to use 24bits. does that still hold true?

ming



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux