[ctf] Simplify the logic of the unsigned long comparator.
authorEtienne Bergeron <etienne.bergeron@gmail.com>
Sun, 24 Nov 2013 05:17:35 +0000 (00:17 -0500)
committerXavier Raynaud <xavier.raynaud@kalray.eu>
Mon, 25 Nov 2013 15:26:05 +0000 (10:26 -0500)
commit1c8799d5e487dd752a4df82170231a9c3e5ea97b
tree4eb7eb68726854eb0ab8aa0da8dc93b7df79022d
parent92d542ebcb6125adff4c3e1d2b80d62b35e552f3
[ctf] Simplify the logic of the unsigned long comparator.

To understand this modification, let assume the "char 8-bits" domain.

unsigned [0 .. 255]
signed [-128 .. 127]

By receiving the parameters encoded in a signed number, the method receives

left:  [0..127,-128..-1]  (which represents [0..127,128..255])
right: [0..127,-128..-1]  (which represents [0..127,128..255])

By definition (on an unconstrained domain), this assertion holds

 left < right  <==>  left + k < right + k

Thus, the idea is to rotate the domain by k to allow a signed operator to
be able to compare to full domain.
In this case k must be -128.

By rotating the domain, left and right range become [-128..-1,0..127],
and are now comparable with the signed operator.

Change-Id: I92b27ab00e8f14102a04e085ef807e211e39a7f0
Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com>
Reviewed-on: https://git.eclipse.org/r/18784
Tested-by: Hudson CI
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Xavier Raynaud <xavier.raynaud@kalray.eu>
IP-Clean: Xavier Raynaud <xavier.raynaud@kalray.eu>
Tested-by: Xavier Raynaud <xavier.raynaud@kalray.eu>
org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/UtilsTest.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Utils.java
This page took 0.026492 seconds and 5 git commands to generate.