[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <E6BF041E97966E4DB955F0DF883AD2D684F1F648@de02wembxa.internal.synopsys.com>
Date: Wed, 28 Aug 2013 19:12:22 +0000
From: Mischa Jonker <Mischa.Jonker@...opsys.com>
To: Joe Perches <joe@...ches.com>,
Mischa Jonker <Mischa.Jonker@...opsys.com>
CC: "Vineet.Gupta1@...opsys.com" <Vineet.Gupta1@...opsys.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] ARC: Fix __udelay parentheses
Hello Joe,
> I don't see the loops_per_jiffy initial shift << 32.
loops_per_jiffy * HZ = loops_per_second
loops_per_jiffy * HZ = 1,000,000 * loops_per_us
loops_per_jiffy * HZ * 4295 = 4,295,000 * loops_per_us
loops_per_jiffy * HZ * 4294.967296 = 2^32 * loops_per_us
> > > > - loops = ((long long)(usecs * 4295 * HZ) *
> > > > - (long long)(loops_per_jiffy)) >> 32;
> > > > + loops = (((long long) usecs) * 4295 * HZ *
> > > > + (long long) loops_per_jiffy) >> 32;
>
> I know that. It's the use of a signed long long vs the unsigned long long
> that I think wrong.
Yes that is wrong too.
>
> Why cast a unsigned to a signed?
I don't know, this was in the original file. The issue that I was trying to solve, was that usleep didn't sleep long enough, and that is fixed by this patch.
Wrt signed/unsigned: would you like me to update this patch or create a separate one?
Mischa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists