Skip to content

Commit 528bfca

Browse files
refactor(const_eval): inline math_pow
1 parent c3ef933 commit 528bfca

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

naga/src/proc/constant_evaluator.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,11 @@ impl<'a> ConstantEvaluator<'a> {
836836
crate::MathFunction::Atanh => {
837837
component_wise_float!(self, span, [arg], |e| { Ok([e.atanh()]) })
838838
}
839-
crate::MathFunction::Pow => self.math_pow(arg, arg1.unwrap(), span),
839+
crate::MathFunction::Pow => {
840+
component_wise_float!(self, span, [arg, arg1.unwrap()], |e1, e2| {
841+
Ok([e1.powf(e2)])
842+
})
843+
}
840844
crate::MathFunction::Clamp => {
841845
component_wise_scalar!(
842846
self,
@@ -912,15 +916,6 @@ impl<'a> ConstantEvaluator<'a> {
912916
}
913917
}
914918

915-
fn math_pow(
916-
&mut self,
917-
e1: Handle<Expression>,
918-
e2: Handle<Expression>,
919-
span: Span,
920-
) -> Result<Handle<Expression>, ConstantEvaluatorError> {
921-
component_wise_float!(self, span, [e1, e2], |e1, e2| { Ok([e1.powf(e2)]) })
922-
}
923-
924919
fn array_length(
925920
&mut self,
926921
array: Handle<Expression>,

0 commit comments

Comments
 (0)