mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Om N." <xhandle@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: writing portable code based on BITS_PER_LONG?
Date: Sat, 5 Aug 2006 23:16:29 -0700	[thread overview]
Message-ID: <6de39a910608052316x37ae7268j5ea18b6ea26219c5@mail.gmail.com> (raw)

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.

Is there any other way?

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

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

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=6de39a910608052316x37ae7268j5ea18b6ea26219c5@mail.gmail.com \
    --to=xhandle@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®