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 Jan 18, 2024
1 parent c2f110e commit 063e110
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 @@ -837,7 +837,11 @@ impl<'a> ConstantEvaluator<'a> {
crate::MathFunction::Atanh => {
component_wise_float!(self, span, [arg], |e| { Ok([e.atanh()]) })
}
crate::MathFunction::Pow => self.math_pow(arg, arg1.unwrap(), span),
crate::MathFunction::Pow => {
component_wise_float!(self, span, [arg, arg1.unwrap()], |e1, e2| {
Ok([e1.powf(e2)])
})
}
crate::MathFunction::Clamp => {
component_wise_scalar!(
self,
Expand Down Expand Up @@ -913,15 +917,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| { Ok([e1.powf(e2)]) })
}

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

0 comments on commit 063e110

Please sign in to comment.