Skip to content
Snippets Groups Projects
Commit c6c6e449 authored by Gary Frost's avatar Gary Frost
Browse files

Committed patch from kenneth@hexad.dk which added support for NAN and INFINITY...

Committed patch from kenneth@hexad.dk which added support for NAN and INFINITY mappings between Java and OpenCL
parent 740deffe
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ We discourage including attribution as comments in the code, instead we intend t
Aparapi Contributors. Thanks to all.
Witold Bolt provided patch for issue #5. Added and tested Mac OS support. Oct 12th 2011
kenneth@hexad.dk provided patch for issue #11 (correcting conversion of Java Nan and Infinity values to OpenCL equiv). Oct 28th 2011
......@@ -442,12 +442,39 @@ abstract class BlockWriter{
} else if (_instruction instanceof Constant<?>) {
Constant<?> constantInstruction = (Constant<?>) _instruction;
Object value = constantInstruction.getValue();
write(value.toString());
if (value instanceof Float) {
write("f");
}
if (value instanceof Long) {
write("L");
Float f = (Float) value;
if (f.isNaN()) {
write("NAN");
} else if (f.isInfinite()) {
if (f < 0){
write("-");
}
write("INFINITY");
} else {
write(value.toString());
write("f");
}
} else if (value instanceof Double) {
Double d = (Double) value;
if (d.isNaN()) {
write("NAN");
} else if (d.isInfinite()) {
if (d < 0){
write("-");
}
write("INFINITY");
} else {
write(value.toString());
}
} else {
write(value.toString());
if (value instanceof Long) {
write("L");
}
}
} else if (_instruction instanceof AccessLocalVariable) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment