stdlib: Make stdlib not error out w/ undefined symbols, add ranges.

This commit is contained in:
John 2025-02-23 03:29:15 -06:00
parent 4d9b13f7a1
commit 5c99bf09ab
3 changed files with 17 additions and 6 deletions

View File

@ -8,5 +8,7 @@ pub mod num;
pub mod str;
pub mod range;
#[cfg("test")]
mod test;

View File

@ -278,9 +278,9 @@ pub mod ops {
}
impl usize {
pub const MIN: Self = __march_ptr_width_unsigned_min();
pub const MAX: Self = __march_ptr_width_unsigned_max();
pub const BIT_WIDTH: u32 = __march_ptr_width_bits();
pub const MIN: Self = (); // __march_ptr_width_unsigned_min(); // TODO: intrinsics
pub const MAX: Self = (); // __march_ptr_width_unsigned_max(); // TODO: intrinsics
pub const BIT_WIDTH: u32 = (); // __march_ptr_width_bits(); // TODO: intrinsics
pub fn default() -> Self {
0
}
@ -512,9 +512,9 @@ pub mod ops {
}
impl isize {
pub const MIN: Self = __march_ptr_width_signed_min();
pub const MAX: Self = __march_ptr_width_signed_max();
pub const BIT_WIDTH: u32 = __march_ptr_width_bits();
pub const MIN: Self = (); // __march_ptr_width_signed_min(); // TODO: intrinsics
pub const MAX: Self = (); // __march_ptr_width_signed_max(); // TODO: intrinsics
pub const BIT_WIDTH: u32 = (); // __march_ptr_width_bits(); // TODO: intrinsics
pub fn default() -> Self {
0
}

9
stdlib/std/range.cl Normal file
View File

@ -0,0 +1,9 @@
//! Iterable ranges
/// An Exclusive Range `a .. b` iterates from a to b, excluding b
#[intrinsic = "range_exc", T]
struct RangeExc(T, T)
/// An Inclusive Range `a ..= b` iterates from a to b, including b
#[intrinsic = "range_inc", T]
struct RangeInc(T, T)