[PATCH 3/5] powerpc/mpc5121: shared DIU framebuffer support

Timur Tabi timur.tabi at gmail.com
Sat May 1 04:18:46 EST 2010


On Fri, Apr 30, 2010 at 11:22 AM, Scott Wood <scottwood at freescale.com> wrote:

>> That's what I meant.  Actually, I think it's ULL.  Regardless, I think
>> the compiler will see the  "1000000000 ... * 1000" and just combine
>> them together.  You're not actually outsmarting the compiler.
>
> The compiler will do no such thing.  That's a valid transformation when
> doing pure math, but not when working with integers.

I ran some tests, and it appears you're right.  I doesn't make a lot
of sense to me, but whatever.

However, "(1000000000 / pixclock) * 1000" produces a result that's
less accurate than "1000000000000ULL / pixclock".  Unfortunately, that
math caused a linker problem with __udivdi3 when I tried it, so maybe
you can use do_div() instead?

>>     err = -1;
>>
>> because he wanted it to be the largest possible integer.
>
> -1 is not the largest possible integer.  LONG_MAX, perhaps?

What, you don't like implicit casting of -1 to an unsigned? :-)

Since err is a long integer, LONG_MAX is the better choice.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the Linuxppc-dev mailing list