fn shl_fixnum_sub(lhs: i64, rhs: i64) -> Value {
    if rhs < u32::MAX as i64 {
        match lhs.checked_shl(rhs as u32) {
            Some(i) => Value::integer(i),
            None => {
                let n = lhs.to_bigint().unwrap() << rhs;
                Value::bignum(n)
            }
        }
    } else {
        Value::bignum(lhs.to_bigint().unwrap() << rhs)
    }
}
rhs must be a non-negative value.
ruruby/src/arith.rs