Skip to content

Commit

Permalink
refact(core): cast MAX and MIN values ​​of usize and isize
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Nov 9, 2023
1 parent 523867d commit 54ce7a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/core/src/int.ri
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extend comptime_int < Stringable {
/// Returns the value of `self` as a string.
#[inline]
public func to_string(&self) -> string {
return @as(int64, self.*).to_string();
return @as(isize, self.*).to_string();
}
}

Expand Down Expand Up @@ -149,8 +149,8 @@ extend int64 < Stringable {
}

extend isize < Stringable {
public const MIN: isize := #if _x64_ int64.MIN #else int32.MIN #endif;
public const MAX: isize := #if _x64_ int64.MAX #else int32.MAX #endif;
public const MIN: isize := @as(isize, #if _x64_ int64.MIN #else int32.MIN #endif);
public const MAX: isize := @as(isize, #if _x64_ int64.MAX #else int32.MAX #endif);

#[inline]
public func bits() -> uint32 {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/uint.c.ri
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ extend uint64 < Stringable {
}

extend usize < Stringable {
public const MAX: usize := #if _x64_ uint64.MAX #else uint32.MAX #endif;
public const MAX: usize := @as(usize, #if _x64_ uint64.MAX #else uint32.MAX #endif);

#[inline]
public func bits() -> uint32 {
Expand Down

0 comments on commit 54ce7a3

Please sign in to comment.