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 5, 2024
1 parent af714c5 commit 99c54f4
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 @@ -808,7 +808,11 @@ impl<'a> ConstantEvaluator<'a> {
crate::MathFunction::Atanh => {
component_wise_float!(self, span, [arg], |e| { Ok(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| {
Ok(e1.powf(e2).into())
})
}
crate::MathFunction::Clamp => {
component_wise_scalar!(
self,
Expand Down Expand Up @@ -884,15 +888,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 99c54f4

Please sign in to comment.