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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 30, 2010 at 11:22 AM, Scott Wood <scottwood@xxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux