diff --git a/src/packages/arithmetic.rs b/src/packages/arithmetic.rs index ead54f8c..cf109b0c 100644 --- a/src/packages/arithmetic.rs +++ b/src/packages/arithmetic.rs @@ -275,27 +275,51 @@ def_package!(crate:ArithmeticPackage:"Basic arithmetic", lib, { #[cfg(not(feature = "unchecked"))] { // Checked basic arithmetic - reg_op!(lib, "+", add, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "-", sub, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "*", mul, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "/", div, i8, u8, i16, u16, i32, u32, u64, i128, u128); + reg_op!(lib, "+", add, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "-", sub, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "*", mul, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "/", div, i8, u8, i16, u16, i32, u32, u64); // Checked bit shifts - reg_op!(lib, "<<", shl, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, ">>", shr, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "%", modulo, i8, u8, i16, u16, i32, u32, u64, i128, u128); + reg_op!(lib, "<<", shl, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, ">>", shr, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "%", modulo, i8, u8, i16, u16, i32, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_op!(lib, "+", add, i128, u128); + reg_op!(lib, "-", sub, i128, u128); + reg_op!(lib, "*", mul, i128, u128); + reg_op!(lib, "/", div, i128, u128); + // Checked bit shifts + reg_op!(lib, "<<", shl, i128, u128); + reg_op!(lib, ">>", shr, i128, u128); + reg_op!(lib, "%", modulo, i128, u128); + } } #[cfg(feature = "unchecked")] { // Unchecked basic arithmetic - reg_op!(lib, "+", add_u, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "-", sub_u, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "*", mul_u, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "/", div_u, i8, u8, i16, u16, i32, u32, u64, i128, u128); + reg_op!(lib, "+", add_u, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "-", sub_u, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "*", mul_u, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "/", div_u, i8, u8, i16, u16, i32, u32, u64); // Unchecked bit shifts - reg_op!(lib, "<<", shl_u, i64, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, ">>", shr_u, i64, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "%", modulo_u, i8, u8, i16, u16, i32, u32, u64, i128, u128); + reg_op!(lib, "<<", shl_u, i64, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, ">>", shr_u, i64, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "%", modulo_u, i8, u8, i16, u16, i32, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_op!(lib, "+", add_u, i128, u128); + reg_op!(lib, "-", sub_u, i128, u128); + reg_op!(lib, "*", mul_u, i128, u128); + reg_op!(lib, "/", div_u, i128, u128); + // Unchecked bit shifts + reg_op!(lib, "<<", shl_u, i128, u128); + reg_op!(lib, ">>", shr_u, i128, u128); + reg_op!(lib, "%", modulo_u, i128, u128); + } } } @@ -311,9 +335,16 @@ def_package!(crate:ArithmeticPackage:"Basic arithmetic", lib, { #[cfg(not(feature = "only_i32"))] #[cfg(not(feature = "only_i64"))] { - reg_op!(lib, "|", binary_or, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "&", binary_and, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "^", binary_xor, i8, u8, i16, u16, i32, u32, u64, i128, u128); + reg_op!(lib, "|", binary_or, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "&", binary_and, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "^", binary_xor, i8, u8, i16, u16, i32, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_op!(lib, "|", binary_or, i128, u128); + reg_op!(lib, "&", binary_and, i128, u128); + reg_op!(lib, "^", binary_xor, i128, u128); + } } #[cfg(not(feature = "no_float"))] @@ -343,8 +374,14 @@ def_package!(crate:ArithmeticPackage:"Basic arithmetic", lib, { #[cfg(not(feature = "only_i32"))] #[cfg(not(feature = "only_i64"))] { - reg_unary!(lib, "-", neg, i8, i16, i32, i64, i128); - reg_unary!(lib, "abs", abs, i8, i16, i32, i64, i128); + reg_unary!(lib, "-", neg, i8, i16, i32, i64); + reg_unary!(lib, "abs", abs, i8, i16, i32, i64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_unary!(lib, "-", neg, i128); + reg_unary!(lib, "abs", abs, i128); + } } } @@ -357,8 +394,14 @@ def_package!(crate:ArithmeticPackage:"Basic arithmetic", lib, { #[cfg(not(feature = "only_i32"))] #[cfg(not(feature = "only_i64"))] { - reg_unary!(lib, "-", neg_u, i8, i16, i32, i64, i128); - reg_unary!(lib, "abs", abs_u, i8, i16, i32, i64, i128); + reg_unary!(lib, "-", neg_u, i8, i16, i32, i64); + reg_unary!(lib, "abs", abs_u, i8, i16, i32, i64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_unary!(lib, "-", neg_u, i128); + reg_unary!(lib, "abs", abs_u, i128); + } } } }); diff --git a/src/packages/array_basic.rs b/src/packages/array_basic.rs index c6904e90..59358063 100644 --- a/src/packages/array_basic.rs +++ b/src/packages/array_basic.rs @@ -98,9 +98,16 @@ def_package!(crate:BasicArrayPackage:"Basic array utilities.", lib, { #[cfg(not(feature = "only_i32"))] #[cfg(not(feature = "only_i64"))] { - reg_op!(lib, "push", push, i8, u8, i16, u16, i32, i64, u32, u64, i128, u128); - reg_pad!(lib, "pad", pad, i8, u8, i16, u16, i32, u32, i64, u64, i128, u128); - reg_tri!(lib, "insert", ins, i8, u8, i16, u16, i32, i64, u32, u64, i128, u128); + reg_op!(lib, "push", push, i8, u8, i16, u16, i32, i64, u32, u64); + reg_pad!(lib, "pad", pad, i8, u8, i16, u16, i32, u32, i64, u64); + reg_tri!(lib, "insert", ins, i8, u8, i16, u16, i32, i64, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_op!(lib, "push", push, i128, u128); + reg_pad!(lib, "pad", pad, i128, u128); + reg_tri!(lib, "insert", ins, i128, u128); + } } #[cfg(not(feature = "no_float"))] diff --git a/src/packages/iter_basic.rs b/src/packages/iter_basic.rs index ebf55992..cccf4b6c 100644 --- a/src/packages/iter_basic.rs +++ b/src/packages/iter_basic.rs @@ -85,7 +85,10 @@ def_package!(crate:BasicIteratorPackage:"Basic range iterators.", lib, { ) } - reg_range!(lib, "range", i8, u8, i16, u16, i32, i64, u32, u64, i128, u128); + reg_range!(lib, "range", i8, u8, i16, u16, i32, i64, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + reg_range!(lib, "range", i128, u128); } reg_step::(lib); @@ -103,6 +106,9 @@ def_package!(crate:BasicIteratorPackage:"Basic range iterators.", lib, { ) } - reg_step!(lib, "range", i8, u8, i16, u16, i32, i64, u32, u64, i128, u128); + reg_step!(lib, "range", i8, u8, i16, u16, i32, i64, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + reg_step!(lib, "range", i128, u128); } }); diff --git a/src/packages/logic.rs b/src/packages/logic.rs index 41ca035f..1cb4b437 100644 --- a/src/packages/logic.rs +++ b/src/packages/logic.rs @@ -36,12 +36,22 @@ def_package!(crate:LogicPackage:"Logical operators.", lib, { #[cfg(not(feature = "only_i32"))] #[cfg(not(feature = "only_i64"))] { - reg_op!(lib, "<", lt, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "<=", lte, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, ">", gt, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, ">=", gte, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "==", eq, i8, u8, i16, u16, i32, u32, u64, i128, u128); - reg_op!(lib, "!=", ne, i8, u8, i16, u16, i32, u32, u64, i128, u128); + reg_op!(lib, "<", lt, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "<=", lte, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, ">", gt, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, ">=", gte, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "==", eq, i8, u8, i16, u16, i32, u32, u64); + reg_op!(lib, "!=", ne, i8, u8, i16, u16, i32, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_op!(lib, "<", lt, i128, u128); + reg_op!(lib, "<=", lte, i128, u128); + reg_op!(lib, ">", gt, i128, u128); + reg_op!(lib, ">=", gte, i128, u128); + reg_op!(lib, "==", eq, i128, u128); + reg_op!(lib, "!=", ne, i128, u128); + } } #[cfg(not(feature = "no_float"))] diff --git a/src/packages/math_basic.rs b/src/packages/math_basic.rs index eea49727..e7ce43b7 100644 --- a/src/packages/math_basic.rs +++ b/src/packages/math_basic.rs @@ -70,8 +70,12 @@ def_package!(crate:BasicMathPackage:"Basic mathematic functions.", lib, { lib.set_fn_1("to_float", |x: u32| Ok(x as FLOAT)); lib.set_fn_1("to_float", |x: i64| Ok(x as FLOAT)); lib.set_fn_1("to_float", |x: u64| Ok(x as FLOAT)); - lib.set_fn_1("to_float", |x: i128| Ok(x as FLOAT)); - lib.set_fn_1("to_float", |x: u128| Ok(x as FLOAT)); + + #[cfg(not(target_arch = "wasm32"))] + { + lib.set_fn_1("to_float", |x: i128| Ok(x as FLOAT)); + lib.set_fn_1("to_float", |x: u128| Ok(x as FLOAT)); + } } } diff --git a/src/packages/string_basic.rs b/src/packages/string_basic.rs index 262a4f3a..338cf5ec 100644 --- a/src/packages/string_basic.rs +++ b/src/packages/string_basic.rs @@ -52,9 +52,16 @@ def_package!(crate:BasicStringPackage:"Basic string utilities, including printin reg_op!(lib, KEYWORD_PRINT, to_string, i8, u8, i16, u16, i32, u32); reg_op!(lib, FUNC_TO_STRING, to_string, i8, u8, i16, u16, i32, u32); reg_op!(lib, KEYWORD_DEBUG, to_debug, i8, u8, i16, u16, i32, u32); - reg_op!(lib, KEYWORD_PRINT, to_string, i64, u64, i128, u128); - reg_op!(lib, FUNC_TO_STRING, to_string, i64, u64, i128, u128); - reg_op!(lib, KEYWORD_DEBUG, to_debug, i64, u64, i128, u128); + reg_op!(lib, KEYWORD_PRINT, to_string, i64, u64); + reg_op!(lib, FUNC_TO_STRING, to_string, i64, u64); + reg_op!(lib, KEYWORD_DEBUG, to_debug, i64, u64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_op!(lib, KEYWORD_PRINT, to_string, i128, u128); + reg_op!(lib, FUNC_TO_STRING, to_string, i128, u128); + reg_op!(lib, KEYWORD_DEBUG, to_debug, i128, u128); + } } #[cfg(not(feature = "no_float"))] diff --git a/src/packages/string_more.rs b/src/packages/string_more.rs index 8f8d1731..46805750 100644 --- a/src/packages/string_more.rs +++ b/src/packages/string_more.rs @@ -95,8 +95,14 @@ def_package!(crate:MoreStringPackage:"Additional string utilities, including str #[cfg(not(feature = "only_i32"))] #[cfg(not(feature = "only_i64"))] { - reg_op!(lib, "+", append, i8, u8, i16, u16, i32, i64, u32, u64, i128, u128); - reg_op!(lib, "+", prepend, i8, u8, i16, u16, i32, i64, u32, u64, i128, u128); + reg_op!(lib, "+", append, i8, u8, i16, u16, i32, i64, u32, u64); + reg_op!(lib, "+", prepend, i8, u8, i16, u16, i32, i64, u32, u64); + + #[cfg(not(target_arch = "wasm32"))] + { + reg_op!(lib, "+", append, i128, u128); + reg_op!(lib, "+", prepend, i128, u128); + } } #[cfg(not(feature = "no_float"))] diff --git a/src/stdlib.rs b/src/stdlib.rs index 1d1397d5..64eda6fb 100644 --- a/src/stdlib.rs +++ b/src/stdlib.rs @@ -4,10 +4,13 @@ mod inner { pub use core::{ any, arch, array, ascii, cell, char, clone, cmp, convert, default, f32, f64, ffi, fmt, - future, hash, hint, i128, i16, i32, i64, i8, isize, iter, marker, mem, num, ops, option, - panic, pin, prelude, ptr, result, slice, str, task, time, u128, u16, u32, u64, u8, usize, + future, hash, hint, i16, i32, i64, i8, isize, iter, marker, mem, num, ops, option, panic, + pin, prelude, ptr, result, slice, str, task, time, u16, u32, u64, u8, usize, }; + #[cfg(not(target_arch = "wasm32"))] + pub use core::{i128, u128}; + pub use alloc::{borrow, boxed, format, rc, string, sync, vec}; pub use core_error as error;