TCH (statz) | #1, Főfasz (10466) |
501 | #2b4b | ^ | Idézet | Sat, 15 Mar 2014 17:01:46 +01 |
188.36.*.* | *.catv.pool.telekom.hu |
A leggyorsabb abs():// Pascal function abs2(v: longint): longword; var x: longint; begin x := v shr 31; abs2 := (v + x) xor x; end; // C unsigned long int abs2(long int v) { long int x = v >> 31; return (v + x) ^ x; }A leggyorsabb sgn(): // Pascal function sgn2(v: longint): longint; begin sgn2 := longint(0 < v) - longint(v < 0); end; // C long int sgn2(long int v) { return (0 < v) - (v < 0); } |