Re: [hackers] [ubase] Fix style issue || sin

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Fri, 7 Mar 2014 08:05:16 +0100

> > Another question, do you use < 0 or == -1? I am talking
> > about checking the return value of open(2) etc.
>
> I think it'd be interesting what's less demanding.
> I suppose "< 0" is more efficient, as there's only a check to the
> sign-bit, whereas comparing two integers (== -1) involves at
> most 8 bit-operations for an 8 bit integer (others respectively).

This is something too much dependent of the processor. Maybe in a
processor is more efficient checking only the sign bit, but maybe
in the next generation is more eficient the comparision of the full
number [1]. It should not be a valid criteria for this subject

I usually use == -1, but < 0 do not disturb me, so for me, both are valid.

-- 
Roberto E. Vargas Caballero
Received on Fri Mar 07 2014 - 08:05:16 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 07 2014 - 08:12:17 CET