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

Re: One more question



Philipp Gühring wrote:

>>if((a<b+11) && (a>b-11))
>
>Nice:
>if (abs(a-b)<10)
>Dirty, perhaps faster:

>if ((unsigned)10+a-b)<20)

stripping the sign bit from 10 won't help much ;)

I guess you mean 

if ((unsigned)(10 + a - b)) < 20)

(Or *do* casts have such a low precedence?? Would be weird IMHO..)


	Christian
-- 

Drive A: not responding...Formatting C: instead