DESCRIPTION

[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: Jordon Obrien xxx@xxx.xxx


COMMENTS

author: Jordon Obrien
date: 2013-11-24 06:06:26.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2013-11-24 06:06:31.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/4116/

-------------------------------------
author: Brenden Conley
date: 2013-11-24 06:50:47.000000000

Patch Set 3: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/4116/ : SUCCESS

-------------------------------------
author: Tessa Dickson
date: 2013-11-24 08:52:31.000000000

Patch Set 3: Code-Review+1

(2 comments)

Clever! One minor possible nit, otherwise good.

Line:64, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Utils.java -> should we say "java does not support unsigned arithmetic" or "java does not support unsigned types" ?

Line:82, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Utils.java -> Wow, that's clever! :)

-------------------------------------
author: Jordon Obrien
date: 2013-11-24 19:52:06.000000000

Patch Set 3:

(2 comments)

address Mathieu comments.

Line:64, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Utils.java -> In fact both are valid. They don't support unsigned arithmetic (try to multiple unsigned number).
The exception is for shifting (which is not a arithmetic operation).

And both facts are important.
  - Unsigned type: useful to know because we encode number as signed integer.
  - Unsigned arithmetic: it justify this function.

As this doesn't worth more discussion. I'll change the sentence to include both,

Line:82, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Utils.java -> classic!

-------------------------------------
