From: Karol Herbst Date: Mon, 4 Mar 2019 18:11:12 +0000 (+0100) Subject: nir: replace magic numbers with M_PI X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5d48359a2c5670d55f24e91229f59efc6368dcba;p=mesa.git nir: replace magic numbers with M_PI we define it inside 'include/c99_math.h' so it is safe to use. Signed-off-by: Karol Herbst Reviewed-by: Jason Ekstrand --- diff --git a/src/compiler/nir/nir_builtin_builder.h b/src/compiler/nir/nir_builtin_builder.h index d1435b37fd4..792fa08e8c5 100644 --- a/src/compiler/nir/nir_builtin_builder.h +++ b/src/compiler/nir/nir_builtin_builder.h @@ -60,7 +60,7 @@ nir_uclamp(nir_builder *b, static inline nir_ssa_def * nir_degrees(nir_builder *b, nir_ssa_def *val) { - return nir_fmul_imm(b, val, 57.2957795131); + return nir_fmul_imm(b, val, 180.0 / M_PI); } static inline nir_ssa_def * @@ -78,7 +78,7 @@ nir_fast_normalize(nir_builder *b, nir_ssa_def *vec) static inline nir_ssa_def * nir_radians(nir_builder *b, nir_ssa_def *val) { - return nir_fmul_imm(b, val, 0.01745329251); + return nir_fmul_imm(b, val, M_PI / 180.0); } #endif /* NIR_BUILTIN_BUILDER_H */