[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
3-way arithmetic IF
I need to compare two integers x and y, and perform routine 1
if x<y, routine 2 if x=y, and routine 3 if x>y. X and Y are
bignums on the order of six words long. The operation must be
as fast as possible.
Testing x<y takes about 85-95 microseconds;
testing x=y takes about 79-83 microseconds;
total worst-case time of about 178 microseconds.
Evaluating (signum (- x y)) takes about 175 microseconds.
Question: Is there a low-level arithmetic IF somewhere down in
the guts of the machine, that supports a single </=/> comparison
between two numbers and then switches control three ways accordingly?
[Disclaimer: Times aren't official, and the decimal could be off.]
John Myers~~