On Sat, 2006-08-05 23:16:29 -0700, Om N. <[email protected]> wrote: > I am trying to port a driver written for IA32. This is a pci driver > and has a chipset doing PCI <-> local bus data transfer, where local > bus is 16 bit. So a number of values are converted by right/left > shifting by 16 bits. > > Now that I am doing porting, I would like to make it fully portable > across AMD64 and IA32. What is the best method for this? Should I do > something like, > > #if BITS_PER_LONG = 64 > shiftwidth = 48 > #else if BITS_PER_LONG = 32 > shiftwidth = 16 > #endif I'd probably write some macros that access the parts of the longs you want to have/set and put these into some header file. MfG, JBG -- Jan-Benedict Glaw [email protected] +49-172-7608481 Signature of: Träume nicht von Dein Leben: Lebe Deinen Traum! the second :
Attachment:
signature.asc
Description: Digital signature
- Follow-Ups:
- Re: writing portable code based on BITS_PER_LONG?
- From: "Om N." <[email protected]>
- Re: writing portable code based on BITS_PER_LONG?
- References:
- writing portable code based on BITS_PER_LONG?
- From: "Om N." <[email protected]>
- writing portable code based on BITS_PER_LONG?
- Prev by Date: Re: sluggish system responsiveness under higher IO load
- Next by Date: Re: [PATCH 01/12] thinkpad_ec: New driver for ThinkPad embedded controller access
- Previous by thread: writing portable code based on BITS_PER_LONG?
- Next by thread: Re: writing portable code based on BITS_PER_LONG?
- Index(es):