File tree Expand file tree Collapse file tree 4 files changed +7
-18
lines changed
main/java/net/openhft/koloboke/collect/impl
test/java/net/openhft/koloboke/collect/impl Expand file tree Collapse file tree 4 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ Add to your Gradle build script:
3939
4040 dependencies {
4141 // `jdk8` instead of `jdk6-7` if you use Java 8
42- compile 'net.openhft:koloboke-api-jdk6-7:0.6.4 '
43- runtime 'net.openhft:koloboke-impl-jdk6-7:0.6.4 '
42+ compile 'net.openhft:koloboke-api-jdk6-7:0.6.5 '
43+ runtime 'net.openhft:koloboke-impl-jdk6-7:0.6.5 '
4444 }
4545
4646Or Maven config (don't forget about jdk6-7/jdk8 suffix):
@@ -49,12 +49,12 @@ Or Maven config (don't forget about jdk6-7/jdk8 suffix):
4949 <dependency>
5050 <groupId>net.openhft</groupId>
5151 <artifactId>koloboke-api-jdk6-7</artifactId>
52- <version>0.6.4 </version>
52+ <version>0.6.5 </version>
5353 </dependency>
5454 <dependency>
5555 <groupId>net.openhft</groupId>
5656 <artifactId>koloboke-impl-jdk6-7</artifactId>
57- <version>0.6.4 </version>
57+ <version>0.6.5 </version>
5858 <scope>runtime</scope>
5959 </dependency>
6060 <dependencies>
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ configure([apiProject, implProject]) {
6464
6565 configurePublishing(project, project. is(apiProject))
6666 archivesBaseName = " koloboke-$project . name -jdk${ libTargetJava == '6' ? '6-7' : '8'} "
67- version = ' 0.6.4 '
67+ version = ' 0.6.5 '
6868 ext. apiVersion = ' 0.6'
6969
7070 poms* . whenConfigured { pom ->
Original file line number Diff line number Diff line change @@ -139,7 +139,6 @@ private static void check(long n) {
139139 }
140140
141141 private static final BigDecimal LONG_MAX_VALUE = valueOf (Long .MAX_VALUE );
142- private static final BigDecimal INT_MAX_VALUE = valueOf (Integer .MAX_VALUE );
143142
144143 final double scale ;
145144 private BigDecimal scaleAsBD ;
@@ -159,19 +158,13 @@ BigDecimal createBD() {
159158
160159 public int scaleUpper (int n ) {
161160 check (n );
162- int lower = scaleLower ( n );
161+ int lower = ( int ) (( double ) n * scale );
163162 return lower < Integer .MAX_VALUE ? lower + 1 : Integer .MAX_VALUE ;
164163 }
165164
166165 public int scaleLower (int n ) {
167166 check (n );
168- double d = ((double ) n ) * scale ;
169- if (d != Math .rint (d )) {
170- return (int ) d ;
171- } else {
172- BigDecimal lower = valueOf (n ).multiply (scaleAsBD ());
173- return lower .compareTo (INT_MAX_VALUE ) < 0 ? lower .intValue () : Integer .MAX_VALUE ;
174- }
167+ return (int ) ((double ) n * scale );
175168 }
176169
177170 public long scaleUpper (long n ) {
Original file line number Diff line number Diff line change @@ -54,10 +54,6 @@ public class ScalerTest {
5454 public static final Collection <Integer > ints = new ArrayList <Integer >();
5555 public static final Collection <Long > longs = new ArrayList <Long >();
5656 static {
57- // special property of this value: multiplied by Math.PI, it results to a double value
58- // which is actually an integer, i. e. d == Math.rint(d)
59- ints .add (415069444 );
60-
6157 for (int i = 1 ; i < 10000 ; i ++) {
6258 ints .add (i );
6359 longs .add ((long ) i );
You can’t perform that action at this time.
0 commit comments