Messages in this thread |  | | | Date | Thu, 13 Jan 2005 22:48:03 -0700 | | From | Andreas Dilger <> | | Subject | Re: [PATCH 2/5] Convert resource to u64 from unsigned long |
| |
On Jan 13, 2005 16:28 -0700, Dave wrote: > Fixed some of the drivers as example just to get working on i386. > + /* > + * FIXME: apparently ia32 does not have u64 divide implementation > + * we cast the pci_resource_len to u32 for the time being > + * this probably should be fixed to support u64 for ia32 > + * and other archs that do not have u64 divide > + */ > +#if BIS_PER_LONG == 64 > maxnr = (pci_resource_len(dev, bar) - board->first_offset) / > (8 << board->reg_shift); > +#else > + maxnr = ((u32)pci_resource_len(dev, bar) - board->first_offset) / > + (8 << board->reg_shift); > +#endif
One of the reasons that ia32 doesn't support 64-bit divide directly is because it is a big red flag that you are probably doing something wrong. This is a prime example - why do a divide when you could do a shift:
maxnr = (pci_resource_len(dev, bar) - board->first_offset) >> (board->reg_shift + 3);
Cheers, Andreas -- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://members.shaw.ca/adilger/ http://members.shaw.ca/golinux/
[unhandled content-type:application/pgp-signature] |  |