[PULL weston] simple fixes

Jonas Ådahl jadahl at gmail.com
Thu Apr 26 23:38:27 PDT 2012


On Fri, Apr 27, 2012 at 8:09 AM,  <yan.wang at linux.intel.com> wrote:
>> On Thu, 26 Apr 2012 19:42:52 -0700 (PDT)
>> yan.wang at linux.intel.com wrote:
>>
>>> > http://cgit.collabora.com/git/user/pq/wayland-demos.git/log/?h=simple-fixes
>> ...
>>> About "simple-shm: render meaningful diagnostics", Because paint_pixels
>>> process pixels one by one, the following may be better:
>>> time/32 -> time>>5
>>> time/64 -> time>>6
>>> time/16 -> time>>4
>>
>> You're saying the compiler does not automatically do that? Dang.
>> I thought it would if given the chance by using nice constant divisors.
>>
>> Right, I didn't pay too much attention to performance, it is a debug
>> app after all. Can be optimised if someone has trouble with it.
>>
>>
>> Thanks,
>> pq
>>
> Yes. Current popular compilers may do this optimization. But ">>" may be
> better. Just suggestion.

IINM the compiler will produce identical output using bitshift and
division when it's trivial to optimize away the division as in the
above case. IMHO using bitshift in these situations just adds
confusion if the purpose of the expression actually was an arithmetic
division.

Jonas


More information about the wayland-devel mailing list