Skip to content

Commit

Permalink
refactor(const_eval): inline math_pow
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Dec 22, 2023
1 parent 4bce0e1 commit 43360cc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions naga/src/proc/constant_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,11 @@ impl<'a> ConstantEvaluator<'a> {
crate::MathFunction::Atanh => {
component_wise_float!(self, span, [arg], |e| { e.atanh().into() })
}
crate::MathFunction::Pow => self.math_pow(arg, arg1.unwrap(), span),
crate::MathFunction::Pow => {
component_wise_float!(self, span, [arg, arg1.unwrap()], |e1, e2| {
e1.powf(e2).into()
})
}
crate::MathFunction::Clamp => {
component_wise_scalar!(
self,
Expand Down Expand Up @@ -844,15 +848,6 @@ impl<'a> ConstantEvaluator<'a> {
}
}

fn math_pow(
&mut self,
e1: Handle<Expression>,
e2: Handle<Expression>,
span: Span,
) -> Result<Handle<Expression>, ConstantEvaluatorError> {
component_wise_float!(self, span, [e1, e2], |e1, e2| { e1.powf(e2).into() })
}

fn array_length(
&mut self,
array: Handle<Expression>,
Expand Down

0 comments on commit 43360cc

Please sign in to comment.