public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Dave <dave.jiang@gmail.com>
Cc: akpm@osdl.org, torvalds@osdl.org, linux-kernel@vger.kernel.org,
	smaurer@teja.com, linux@arm.linux.org.uk, dsaxena@plexity.net,
	drew.moseley@intel.com, mporter@kernel.crashing.org
Subject: Re: [PATCH 2/5] Convert resource to u64 from unsigned long
Date: Thu, 13 Jan 2005 22:48:03 -0700	[thread overview]
Message-ID: <20050114054803.GA22715@schnapps.adilger.int> (raw)
In-Reply-To: <8746466a050113152843f32a2f@mail.gmail.com>

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

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/


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

      reply	other threads:[~2005-01-14  5:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13 23:28 [PATCH 2/5] Convert resource to u64 from unsigned long Dave
2005-01-14  5:48 ` Andreas Dilger [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=20050114054803.GA22715@schnapps.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=akpm@osdl.org \
    --cc=dave.jiang@gmail.com \
    --cc=drew.moseley@intel.com \
    --cc=dsaxena@plexity.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mporter@kernel.crashing.org \
    --cc=smaurer@teja.com \
    --cc=torvalds@osdl.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