[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20060806103143.GR20586@lug-owl.de>
Date: Sun, 6 Aug 2006 12:31:43 +0200
From: Jan-Benedict Glaw <jbglaw@...-owl.de>
To: "Om N." <xhandle@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: writing portable code based on BITS_PER_LONG?
On Sat, 2006-08-05 23:16:29 -0700, Om N. <xhandle@...il.com> 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 jbglaw@...-owl.de +49-172-7608481
Signature of: Träume nicht von Dein Leben: Lebe Deinen Traum!
the second :
Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)
Powered by blists - more mailing lists