I have some values(floats) to compare, i did a 1 bilion loop for a test, with my potato pc this need 16 sec:
if (a<>aa) or (b<>bb) or (c<>cc) then
This need 25 sec
if CompareMem(@WholeReadA, @WholeReadB, sizeof(WholeReadA)) <> true then
Then i tought of xoring the values this need 3.8 sec
k := pinteger(@a)^ xor pinteger(@b)^ xor pinteger(@c)^;
...
if (k <> pinteger(@aa)^ xor pinteger(@bb)^ xor pinteger(@cc)^) then
Theres some faster way ?
Ps. i know that if aa,bb,cc have swapped values it count as nothing happened with the xoring
EDIT:
I have no need to do the comparsion one bilion times it was just a question.
Im not casting the int to truncate the float but to do the xor on the same bits
Real
in Pascal it most likely is aReal
problem... I think you wanted to ask if it's always about 3 values, but then the "25 sec" example does not fit in.if
is not the only way - usingcase
has the advantage to evaluate the expression only once to then just check in which range it falls. Surprisingly many programmers don't know this performance reason, let alone how to properly use it.