[
https://issues.apache.org/jira/browse/HBASE-9589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13799738#comment-13799738
]
Gustavo Anatoly commented on HBASE-9589:
----------------------------------------
Ted, I saw your comment now, sorry. Your example is interesting:
{code}
long diff = Integer.MAX_VALUE + 2;
int x = (int) diff; // x -2147483647
{code}
I did the same example, changing 2 by 1, and really the value is negative.
Other interesting point is, if you try assign {code} long diff =
4251398048237748224; // Error out of range {code}
But, when:
{code}
long max = Long.parseLong("4251398048237748224");
System.out.println("Max: " + max); // max = 4251398048237748224
if (max < Long.MAX_VALUE) {
System.out.println("Less than Long.MAX_VALUE");
}
int x = (int) max;
System.out.println("(int) long: " + x); // x = 0
{code}
Interesting :)
Thanks for you attention.
> 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)