mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: "Om N." <xhandle@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: writing portable code based on BITS_PER_LONG?
Date: Sun, 6 Aug 2006 12:31:43 +0200	[thread overview]
Message-ID: <20060806103143.GR20586@lug-owl.de> (raw)
In-Reply-To: <6de39a910608052316x37ae7268j5ea18b6ea26219c5@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

On Sat, 2006-08-05 23:16:29 -0700, Om N. <xhandle@gmail.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@lug-owl.de                +49-172-7608481
Signature of:                  Träume nicht von Dein Leben: Lebe Deinen Traum!
the second  :

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-08-06 10:31 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 [this message]
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=20060806103143.GR20586@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --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®