Skip to content

Commit

Permalink
[naga wgsl-in] Clarify match in automatic_conversion_join.
Browse files Browse the repository at this point in the history
Co-authored-by: Teodor Tanasoaia <[email protected]>
  • Loading branch information
jimblandy and teoxoy committed Nov 27, 2023
1 parent d1519b5 commit c7cf770
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions naga/src/front/wgsl/lower/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,26 +330,16 @@ impl crate::Scalar {
}

// AbstractInt converts to AbstractFloat.
(Sk::AbstractFloat | Sk::AbstractInt, Sk::AbstractFloat | Sk::AbstractInt) => {
Some(Self {
kind: Sk::AbstractFloat,
width: crate::ABSTRACT_WIDTH,
})
}
(Sk::AbstractFloat, Sk::AbstractInt) => Some(other),
(Sk::AbstractInt, Sk::AbstractFloat) => Some(self),

// AbstractFloat converts to Float.
(Sk::AbstractFloat, Sk::Float) => Some(Self::float(other.width)),
(Sk::Float, Sk::AbstractFloat) => Some(Self::float(self.width)),
(Sk::AbstractFloat, Sk::Float) => Some(other),
(Sk::Float, Sk::AbstractFloat) => Some(self),

// AbstractInt converts to concrete integer or float.
(Sk::AbstractInt, kind @ (Sk::Uint | Sk::Sint | Sk::Float)) => Some(Self {
kind,
width: other.width,
}),
(kind @ (Sk::Uint | Sk::Sint | Sk::Float), Sk::AbstractInt) => Some(Self {
kind,
width: self.width,
}),
(Sk::AbstractInt, Sk::Uint | Sk::Sint | Sk::Float) => Some(other),
(Sk::Uint | Sk::Sint | Sk::Float, Sk::AbstractInt) => Some(self),

// AbstractFloat can't be reconciled with concrete integer types.
(Sk::AbstractFloat, Sk::Uint | Sk::Sint) | (Sk::Uint | Sk::Sint, Sk::AbstractFloat) => {
Expand Down

0 comments on commit c7cf770

Please sign in to comment.