于 2012/4/27 14:56, [email protected] 写道:
On Fri, Apr 27, 2012 at 8:09 AM,<[email protected]>  wrote:
On Thu, 26 Apr 2012 19:42:52 -0700 (PDT)
[email protected] 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

Could you please explain what are IINM and IMHO? Very thanks.

google gives that:

IINM :  If I'm Not Mistaken
IMHO :  In my humble opinion



Yan Wang

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to