[ 
https://issues.apache.org/jira/browse/HBASE-9589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13796820#comment-13796820
 ] 

Gustavo Anatoly commented on HBASE-9589:
----------------------------------------

Hi, Ted.

I was debugging the code above and saw that diff casting to integer, returns 
zero to X and stepping into to the conditional block, where the X value is 
changed, and running TestBytes#testSplit2 to debug, we have:

{code}
long lw = 4697024864412005480
long rw = 8804307724573897832
long diff = lw ^ rw 
diff = 4251398048237748224

// The cast below, return 0
int x = (int) diff;

// Step into
if (x == 0) {
    x = (int) (diff >>> 32);
    n = 32;
}

Now, x = 989855744
{code}

Ted, forgive me if my understanding it's wrong. There are other reason that I 
can't see, the causes why X cannot be zero?

> Bytes#LexicographicalComparerHolder#UnsafeComparer#compareTo() has dead code
> ----------------------------------------------------------------------------
>
>                 Key: HBASE-9589
>                 URL: https://issues.apache.org/jira/browse/HBASE-9589
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> Starting with line 1177:
> {code}
>           if (diff != 0) {
>             if (!littleEndian) {
>               return lessThanUnsigned(lw, rw) ? -1 : 1;
>             }
>             // Use binary search
>             int n = 0;
>             int y;
>             int x = (int) diff;
>             if (x == 0) {
>               x = (int) (diff >>> 32);
> {code}
> The value of "x" cannot be equal to 0.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to