mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* writing portable code based on BITS_PER_LONG?
@ 2006-08-06  6:16 Om N.
  2006-08-06 10:31 ` Jan-Benedict Glaw
  2006-08-06 16:12 ` Arjan van de Ven
  0 siblings, 2 replies; 4+ messages in thread
From: Om N. @ 2006-08-06  6:16 UTC (permalink / raw)
  To: linux-kernel

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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-06 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-06  6:16 writing portable code based on BITS_PER_LONG? 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 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®