Mercurial > jhg
comparison src/org/tmatesoft/hg/core/Nodeid.java @ 301:88c58edc0857
Remarks about sorting order
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Sat, 17 Sep 2011 14:00:48 +0200 |
| parents | 0a2f445de774 |
| children | 85b8efde5586 |
comparison
equal
deleted
inserted
replaced
| 300:650b45d290b1 | 301:88c58edc0857 |
|---|---|
| 90 if (this == o) { | 90 if (this == o) { |
| 91 return 0; | 91 return 0; |
| 92 } | 92 } |
| 93 for (int i = 0; i < 20; i++) { | 93 for (int i = 0; i < 20; i++) { |
| 94 if (binaryData[i] != o.binaryData[i]) { | 94 if (binaryData[i] != o.binaryData[i]) { |
| 95 // if we need truly ascending sort, need to respect byte sign | |
| 96 // return (binaryData[i] & 0xFF) < (o.binaryData[i] & 0xFF) ? -1 : 1; | |
| 97 // however, for our purposes partial sort is pretty enough | |
| 95 return binaryData[i] < o.binaryData[i] ? -1 : 1; | 98 return binaryData[i] < o.binaryData[i] ? -1 : 1; |
| 96 } | 99 } |
| 97 } | 100 } |
| 98 return 0; | 101 return 0; |
| 99 } | 102 } |
