mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Remove castToNat
This commit is contained in:
parent
0bebb64bae
commit
b57ebb6229
8 changed files with 2 additions and 22 deletions
|
@ -81,7 +81,6 @@ comptime {
|
|||
exportNumFn(num.asin, "asin");
|
||||
exportNumFn(num.bytesToU16C, "bytes_to_u16");
|
||||
exportNumFn(num.bytesToU32C, "bytes_to_u32");
|
||||
exportNumFn(num.castToNat, "cast_to_nat");
|
||||
exportNumFn(num.round, "round");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,10 +41,6 @@ fn bytesToU32(arg: RocList, position: usize) u32 {
|
|||
return @bitCast(u32, [_]u8{ bytes[position], bytes[position + 1], bytes[position + 2], bytes[position + 3] });
|
||||
}
|
||||
|
||||
pub fn castToNat(num: i64) callconv(.C) usize {
|
||||
return @intCast(usize, num);
|
||||
}
|
||||
|
||||
pub fn round(num: f64) callconv(.C) i64 {
|
||||
return @floatToInt(i32, (@round(num)));
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ pub const NUM_IS_FINITE: &str = "roc_builtins.num.is_finite";
|
|||
pub const NUM_POW_INT: &str = "roc_builtins.num.pow_int";
|
||||
pub const NUM_BYTES_TO_U16: &str = "roc_builtins.num.bytes_to_u16";
|
||||
pub const NUM_BYTES_TO_U32: &str = "roc_builtins.num.bytes_to_u32";
|
||||
pub const NUM_CAST_TO_NAT: &str = "roc_builtins.num.cast_to_nat";
|
||||
pub const NUM_ROUND: &str = "roc_builtins.num.round";
|
||||
|
||||
pub const STR_INIT: &str = "roc_builtins.str.init";
|
||||
|
|
|
@ -501,13 +501,6 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
Box::new(float_type(flex(TVAR1))),
|
||||
);
|
||||
|
||||
// castToNat : Num a -> Nat
|
||||
add_top_level_function_type!(
|
||||
Symbol::NUM_CAST_TO_NAT,
|
||||
vec![int_type(flex(TVAR1))],
|
||||
Box::new(nat_type()),
|
||||
);
|
||||
|
||||
// bytesToU16 : List U8, Nat -> Result U16 [ OutOfBounds ]
|
||||
{
|
||||
let position_out_of_bounds = SolvedType::TagUnion(
|
||||
|
|
|
@ -3404,7 +3404,7 @@ fn num_bytes_to(symbol: Symbol, var_store: &mut VarStore, offset: i64, low_level
|
|||
RunLowLevel {
|
||||
ret_var: cast_var,
|
||||
args: vec![(cast_var, Num(var_store.fresh(), offset))],
|
||||
op: LowLevel::NumCastToNat,
|
||||
op: LowLevel::NumIntCast,
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -4740,11 +4740,6 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
}
|
||||
}
|
||||
}
|
||||
NumCastToNat => {
|
||||
debug_assert_eq!(args.len(), 1);
|
||||
let num = load_symbol(scope, &args[0]).into_int_value();
|
||||
call_bitcode_fn(env, &[num.into()], bitcode::NUM_CAST_TO_NAT)
|
||||
}
|
||||
NumBytesToU16 => {
|
||||
debug_assert_eq!(args.len(), 2);
|
||||
let list = load_symbol(scope, &args[0]).into_struct_value();
|
||||
|
|
|
@ -89,7 +89,6 @@ pub enum LowLevel {
|
|||
NumAsin,
|
||||
NumBytesToU16,
|
||||
NumBytesToU32,
|
||||
NumCastToNat,
|
||||
NumBitwiseAnd,
|
||||
NumBitwiseXor,
|
||||
NumBitwiseOr,
|
||||
|
@ -126,7 +125,7 @@ impl LowLevel {
|
|||
| NumSqrtUnchecked | NumLogUnchecked | NumRound | NumToFloat | NumPow | NumCeiling
|
||||
| NumPowInt | NumFloor | NumIsFinite | NumAtan | NumAcos | NumAsin | NumBitwiseAnd
|
||||
| NumBitwiseXor | NumBitwiseOr | NumShiftLeftBy | NumShiftRightBy | NumBytesToU16
|
||||
| NumBytesToU32 | NumCastToNat | NumShiftRightZfBy | NumIntCast | Eq | NotEq | And
|
||||
| NumBytesToU32 | NumShiftRightZfBy | NumIntCast | Eq | NotEq | And
|
||||
| Or | Not | Hash | ExpectTrue => false,
|
||||
|
||||
ListMap | ListMap2 | ListMap3 | ListMapWithIndex | ListKeepIf | ListWalk
|
||||
|
|
|
@ -1011,7 +1011,6 @@ pub fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[bool] {
|
|||
| NumIntCast => arena.alloc_slice_copy(&[irrelevant]),
|
||||
NumBytesToU16 => arena.alloc_slice_copy(&[borrowed, irrelevant]),
|
||||
NumBytesToU32 => arena.alloc_slice_copy(&[borrowed, irrelevant]),
|
||||
NumCastToNat => arena.alloc_slice_copy(&[irrelevant]),
|
||||
StrStartsWith | StrEndsWith => arena.alloc_slice_copy(&[owned, borrowed]),
|
||||
StrStartsWithCodePt => arena.alloc_slice_copy(&[borrowed, irrelevant]),
|
||||
StrFromUtf8 => arena.alloc_slice_copy(&[owned]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue