package org.jruby.ir.operands;
import org.jruby.ir.IRVisitor;
import org.jruby.runtime.ThreadContext;
public class UnboxedFixnum extends ImmutableLiteral {
final public long value;
public UnboxedFixnum(long val) {
super();
value = val;
}
@Override
public OperandType getOperandType() {
return OperandType.UNBOXED_FIXNUM;
}
@Override
public Object createCacheObject(ThreadContext context) {
return context.runtime.newFixnum(value);
}
@Override
public int hashCode() {
return 47 * 7 + (int) (this.value ^ (this.value >>> 32));
}
@Override
public boolean equals(Object other) {
return other instanceof UnboxedFixnum && value == ((UnboxedFixnum) other).value;
}
@Override
public void visit(IRVisitor visitor) {
visitor.UnboxedFixnum(this);
}
public long getValue() {
return value;
}
@Override
public String toString() {
return "UnboxedFixnum:" + value;
}
@Override
public boolean isTruthyImmediate() {
return true;
}
}