nir: replace magic numbers with M_PI
authorKarol Herbst <kherbst@redhat.com>
Mon, 4 Mar 2019 18:11:12 +0000 (19:11 +0100)
committerKarol Herbst <kherbst@redhat.com>
Tue, 5 Mar 2019 21:28:29 +0000 (22:28 +0100)
we define it inside 'include/c99_math.h' so it is safe to use.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_builtin_builder.h

index d1435b37fd43f2ce1452fd4da7fb2932d6fe3d9d..792fa08e8c51dfda4b52594e6ed6e611e226bb81 100644 (file)
@@ -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 */