Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
enricozb committed May 30, 2024
1 parent baf7e23 commit a51bcf2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/hvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ impl Numb {
}

// Cast a number to another type.
// The semantics are meant to spiritually resemble rust's numeric casts:
// - i24 <-> u24: is just reinterpretation of bits
// - f24 -> i24,
// f24 -> u24: casts to the "closest" integer representing this float,
// saturating if out of range and 0 if NaN
// - i24 -> f24,
// u24 -> f24: casts to the "closest" float representing this integer.
pub fn cast(a: Self, b: Self) -> Self {
match (a.get_sym(), b.get_typ()) {
(TY_U24, TY_U24) => b,
Expand Down

0 comments on commit a51bcf2

Please sign in to comment.