Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/ch.randelshofer.fastdoubleparser/ch/randelshofer/fastdoubleparser/FastDoubleSwar.java
  • Loading branch information
wrandelshofer committed Aug 12, 2022
2 parents e75e740 + ca607b4 commit 69cdb36
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 19 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ 19-ea ]
java: [ 17 ]
arch: [ x64 ]
fail-fast: false
max-parallel: 4
Expand All @@ -22,11 +22,11 @@ jobs:
architecture: ${{ matrix.arch }}

- name: Compile FastDoubleParser
run: javac --release 19 --enable-preview -d out -encoding utf8 --module-source-path src/main/java --module ch.randelshofer.fastdoubleparser
run: javac -d out -encoding utf8 --module-source-path src/main/java --module ch.randelshofer.fastdoubleparser
- name: Compile FastDoubleParserDemo
run: javac --release 19 --enable-preview -d out -encoding utf8 -p out --module-source-path FastDoubleParserDemo/src/main/java --module ch.randelshofer.fastdoubleparserdemo
run: javac -d out -encoding utf8 -p out --module-source-path FastDoubleParserDemo/src/main/java --module ch.randelshofer.fastdoubleparserdemo
- name: Run Test 1
run: java --enable-preview --module-path out --module ch.randelshofer.fastdoubleparserdemo/ch.randelshofer.fastdoubleparserdemo.Main
run: java --module-path out --module ch.randelshofer.fastdoubleparserdemo/ch.randelshofer.fastdoubleparserdemo.Main
- name: Run Test 2
run: java --enable-preview --module-path out --module ch.randelshofer.fastdoubleparserdemo/ch.randelshofer.fastdoubleparserdemo.Main data/canada.txt
run: java --module-path out --module ch.randelshofer.fastdoubleparserdemo/ch.randelshofer.fastdoubleparserdemo.Main data/canada.txt
...
3 changes: 0 additions & 3 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
abstract class AbstractFloatingPointBitsFromCharSequence extends AbstractFloatValueParser {

public static final boolean FALL_BACK_TO_BIGDECIMAL = false;

private boolean isDigit(char c) {
return '0' <= c && c <= '9';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class FastDoubleSwar {
* returns a negative value if {@code value} does not contain 8 hex digits
*/

@SuppressWarnings("IntegerMultiplicationImplicitCastToLong")
public static int tryToParseEightDigitsUtf16(char[] a, int offset) {
long first = a[offset]
| (long) a[offset + 1] << 16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
* Provides fast parsers for double and float values.
*/
module ch.randelshofer.fastdoubleparser {
requires jdk.incubator.vector;
exports ch.randelshofer.fastdoubleparser;
}
72 changes: 65 additions & 7 deletions test/junit5/java/ch/randelshofer/fastdoubleparser/TestData.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,35 @@

package ch.randelshofer.fastdoubleparser;

record TestData(String title,
String input,
int charOffset, int charLength,
int byteOffset, int byteLength,
double expectedDoubleValue,
float expectedFloatValue,
boolean valid) {
final class TestData {
private final String title;
private final String input;
private final int charOffset;
private final int charLength;
private final int byteOffset;
private final int byteLength;
private final double expectedDoubleValue;
private final float expectedFloatValue;
private final boolean valid;

TestData(String title,
String input,
int charOffset, int charLength,
int byteOffset, int byteLength,
double expectedDoubleValue,
float expectedFloatValue,
boolean valid) {
this.title = title;
this.input = input;
this.charOffset = charOffset;
this.charLength = charLength;
this.byteOffset = byteOffset;
this.byteLength = byteLength;
this.expectedDoubleValue = expectedDoubleValue;
this.expectedFloatValue = expectedFloatValue;
this.valid = valid;
}

public TestData(String input, double expectedDoubleValue, float expectedFloatValue) {
this(input, input, 0, input.length(), 0, input.length(),
expectedDoubleValue,
Expand Down Expand Up @@ -39,4 +61,40 @@ public TestData(String title, String input) {
Double.NaN,
Float.NaN, false);
}

public String title() {
return title;
}

public String input() {
return input;
}

public int charOffset() {
return charOffset;
}

public int charLength() {
return charLength;
}

public int byteOffset() {
return byteOffset;
}

public int byteLength() {
return byteLength;
}

public double expectedDoubleValue() {
return expectedDoubleValue;
}

public float expectedFloatValue() {
return expectedFloatValue;
}

public boolean valid() {
return valid;
}
}

0 comments on commit 69cdb36

Please sign in to comment.