use of com.oracle.truffle.llvm.parser.model.symbols.constants.integer.BigIntegerConstant in project sulong by graalvm.
the class ParseUtil method asLong.
public static long asLong(long[] args, int index, Metadata md) {
final int typeIndex = index << 1;
if (typeIndex >= args.length) {
return DEFAULT_NUMBER;
}
final Type type = md.getTypeById(args[typeIndex]);
if (type == MetaType.METADATA || VoidType.INSTANCE.equals(type)) {
return DEFAULT_NUMBER;
}
final int valueIndex = typeIndex + 1;
final SymbolImpl value = md.getScope().getSymbols().getOrNull((int) args[valueIndex]);
if (value instanceof IntegerConstant) {
return ((IntegerConstant) value).getValue();
} else if (value instanceof BigIntegerConstant) {
return ((BigIntegerConstant) value).getValue().longValue();
} else if (value instanceof NullConstant || value instanceof UndefinedConstant) {
return 0L;
} else {
return DEFAULT_NUMBER;
}
}
use of com.oracle.truffle.llvm.parser.model.symbols.constants.integer.BigIntegerConstant in project sulong by graalvm.
the class ParseUtil method isInteger.
public static boolean isInteger(long[] args, int index, Metadata md) {
final int typeIndex = index << 1;
final Type type = md.getTypeById(args[typeIndex]);
if (type == MetaType.METADATA || VoidType.INSTANCE.equals(type)) {
return false;
}
final int valueIndex = typeIndex + 1;
final SymbolImpl value = md.getScope().getSymbols().getOrNull((int) args[valueIndex]);
return value instanceof IntegerConstant || value instanceof BigIntegerConstant || value instanceof NullConstant || value instanceof UndefinedConstant;
}
Aggregations