mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: "Om N." <xhandle@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: writing portable code based on BITS_PER_LONG?
Date: Sun, 06 Aug 2006 18:12:55 +0200	[thread overview]
Message-ID: <1154880775.3054.118.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <6de39a910608052316x37ae7268j5ea18b6ea26219c5@mail.gmail.com>

On Sat, 2006-08-05 at 23:16 -0700, Om N. wrote:
> Hi,
> 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 don't like this. I would not do it if there is some elegant way.


if you have a fixed sized bus, how about using the linux fixed size data
types? 

Also, maybe it would be a good idea to post the url to your code so that
people on this list can do a quick 64-bit safeness audit of your
driver... free work/help and all that ;-)

Greetings,
   Arjan van de Ven

-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com



      parent reply	other threads:[~2006-08-06 16:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-06  6:16 Om N.
2006-08-06 10:31 ` Jan-Benedict Glaw
2006-08-06 20:08   ` Om N.
2006-08-06 16:12 ` Arjan van de Ven [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1154880775.3054.118.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xhandle@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®