com.oracle.truffle.api.dsl.test.TSGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-instrument-test Show documentation
Show all versions of truffle-instrument-test Show documentation
Instrumentation tests including InstrumentationTestLanguage.
The newest version!
// CheckStyle: start generated
package com.oracle.truffle.api.dsl.test;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.test.ImplicitCastTest.TS;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
@GeneratedBy(TS.class)
public final class TSGen extends TS {
@Deprecated public static final TSGen TS = new TSGen();
protected TSGen() {
}
public static long expectImplicitLong(int state, Object value) throws UnexpectedResultException {
if ((state & 0b1) != 0 && value instanceof Short) {
return promoteToLong((short) value);
} else if ((state & 0b10) != 0 && value instanceof Long) {
return (long) value;
} else if ((state & 0b100) != 0 && value instanceof Integer) {
return promoteToLong((int) value);
} else if ((state & 0b1000) != 0 && value instanceof Byte) {
return promoteToLong((byte) value);
} else {
throw new UnexpectedResultException(value);
}
}
public static boolean isImplicitLong(int state, Object value) {
return ((state & 0b1) != 0 && value instanceof Short)
|| ((state & 0b10) != 0 && value instanceof Long)
|| ((state & 0b100) != 0 && value instanceof Integer)
|| ((state & 0b1000) != 0 && value instanceof Byte);
}
public static long asImplicitLong(int state, Object value) {
if ((state & 0b1) != 0 && value instanceof Short) {
return promoteToLong((short) value);
} else if ((state & 0b10) != 0 && value instanceof Long) {
return (long) value;
} else if ((state & 0b100) != 0 && value instanceof Integer) {
return promoteToLong((int) value);
} else if ((state & 0b1000) != 0 && value instanceof Byte) {
return promoteToLong((byte) value);
} else {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new IllegalArgumentException("Illegal type ");
}
}
public static int specializeImplicitLong(Object value) {
if (value instanceof Short) {
return 0b1;
} else if (value instanceof Long) {
return 0b10;
} else if (value instanceof Integer) {
return 0b100;
} else if (value instanceof Byte) {
return 0b1000;
} else {
return 0;
}
}
public static int expectImplicitInteger(int state, Object value) throws UnexpectedResultException {
if ((state & 0b1) != 0 && value instanceof Short) {
return promoteToInt((short) value);
} else if ((state & 0b10) != 0 && value instanceof Integer) {
return (int) value;
} else if ((state & 0b100) != 0 && value instanceof Byte) {
return promoteToInt((byte) value);
} else {
throw new UnexpectedResultException(value);
}
}
public static boolean isImplicitInteger(int state, Object value) {
return ((state & 0b1) != 0 && value instanceof Short)
|| ((state & 0b10) != 0 && value instanceof Integer)
|| ((state & 0b100) != 0 && value instanceof Byte);
}
public static int asImplicitInteger(int state, Object value) {
if ((state & 0b1) != 0 && value instanceof Short) {
return promoteToInt((short) value);
} else if ((state & 0b10) != 0 && value instanceof Integer) {
return (int) value;
} else if ((state & 0b100) != 0 && value instanceof Byte) {
return promoteToInt((byte) value);
} else {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new IllegalArgumentException("Illegal type ");
}
}
public static int specializeImplicitInteger(Object value) {
if (value instanceof Short) {
return 0b1;
} else if (value instanceof Integer) {
return 0b10;
} else if (value instanceof Byte) {
return 0b100;
} else {
return 0;
}
}
public static double expectImplicitDouble(int state, Object value) throws UnexpectedResultException {
if ((state & 0b1) != 0 && value instanceof Float) {
return promoteToDouble((float) value);
} else if ((state & 0b10) != 0 && value instanceof Double) {
return (double) value;
} else {
throw new UnexpectedResultException(value);
}
}
public static boolean isImplicitDouble(int state, Object value) {
return ((state & 0b1) != 0 && value instanceof Float)
|| ((state & 0b10) != 0 && value instanceof Double);
}
public static double asImplicitDouble(int state, Object value) {
if ((state & 0b1) != 0 && value instanceof Float) {
return promoteToDouble((float) value);
} else if ((state & 0b10) != 0 && value instanceof Double) {
return (double) value;
} else {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new IllegalArgumentException("Illegal type ");
}
}
public static int specializeImplicitDouble(Object value) {
if (value instanceof Float) {
return 0b1;
} else if (value instanceof Double) {
return 0b10;
} else {
return 0;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy