View Single Post
Old 07-10-2012, 08:55 PM   #83
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Ternary form no good?

Quote:
Originally Posted by knc1 View Post
Code:
frames_to_deliver = frames_to_deliver > 4096 ? 4096 : frames_to_deliver;
First, do a quick re-write of that statement then re-run it.

Why?
There was a recent GCC bug fixed in the ARM arch for "wrong code generation" from that construct.
Quicker to just re-write it and re-test than run down all of the who/what/when/why of the bug.
Ah. Okay thanks. Ternary to be binned. noted.

I'll give it another pop then

I went with

Code:
if (frames_to_deliver > 4096)
		{frames_to_deliver = 4096;}
Seemed rather pointless as a construct all in.

EDIT: It didn't help, but good catch anyways. Frankly I'm not so keen on this second example.
The first one is much more robust.

Last edited by twobob; 07-10-2012 at 09:04 PM. Reason: added reworked code
twobob is offline   Reply With Quote