diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 11:33:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 13:17:08 +0300 |
commit | f68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch) | |
tree | 2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/blenkernel/intern/type_conversions.cc | |
parent | c7b247a118e302a3afc6473797e53b6af28b69e2 (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/blenkernel/intern/type_conversions.cc')
-rw-r--r-- | source/blender/blenkernel/intern/type_conversions.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/type_conversions.cc b/source/blender/blenkernel/intern/type_conversions.cc index 852fe38c92f..ffc5442af2d 100644 --- a/source/blender/blenkernel/intern/type_conversions.cc +++ b/source/blender/blenkernel/intern/type_conversions.cc @@ -49,7 +49,7 @@ static float3 float_to_float3(const float &a) } static int32_t float_to_int(const float &a) { - return (int32_t)a; + return int32_t(a); } static bool float_to_bool(const float &a) { @@ -79,7 +79,7 @@ static float float2_to_float(const float2 &a) } static int float2_to_int(const float2 &a) { - return (int32_t)((a.x + a.y) / 2.0f); + return int32_t((a.x + a.y) / 2.0f); } static bool float2_to_bool(const float2 &a) { @@ -112,7 +112,7 @@ static float float3_to_float(const float3 &a) } static int float3_to_int(const float3 &a) { - return (int)((a.x + a.y + a.z) / 3.0f); + return int((a.x + a.y + a.z) / 3.0f); } static float2 float3_to_float2(const float3 &a) { @@ -138,19 +138,19 @@ static int8_t int_to_int8(const int32_t &a) } static float int_to_float(const int32_t &a) { - return (float)a; + return float(a); } static float2 int_to_float2(const int32_t &a) { - return float2((float)a); + return float2(float(a)); } static float3 int_to_float3(const int32_t &a) { - return float3((float)a); + return float3(float(a)); } static ColorGeometry4f int_to_color(const int32_t &a) { - return ColorGeometry4f((float)a, (float)a, (float)a, 1.0f); + return ColorGeometry4f(float(a), float(a), float(a), 1.0f); } static ColorGeometry4b int_to_byte_color(const int32_t &a) { @@ -167,19 +167,19 @@ static int int8_to_int(const int8_t &a) } static float int8_to_float(const int8_t &a) { - return (float)a; + return float(a); } static float2 int8_to_float2(const int8_t &a) { - return float2((float)a); + return float2(float(a)); } static float3 int8_to_float3(const int8_t &a) { - return float3((float)a); + return float3(float(a)); } static ColorGeometry4f int8_to_color(const int8_t &a) { - return ColorGeometry4f((float)a, (float)a, (float)a, 1.0f); + return ColorGeometry4f(float(a), float(a), float(a), 1.0f); } static ColorGeometry4b int8_to_byte_color(const int8_t &a) { @@ -188,7 +188,7 @@ static ColorGeometry4b int8_to_byte_color(const int8_t &a) static float bool_to_float(const bool &a) { - return (bool)a; + return bool(a); } static int8_t bool_to_int8(const bool &a) { @@ -196,7 +196,7 @@ static int8_t bool_to_int8(const bool &a) } static int32_t bool_to_int(const bool &a) { - return (int32_t)a; + return int32_t(a); } static float2 bool_to_float2(const bool &a) { @@ -225,7 +225,7 @@ static float color_to_float(const ColorGeometry4f &a) } static int32_t color_to_int(const ColorGeometry4f &a) { - return (int)rgb_to_grayscale(a); + return int(rgb_to_grayscale(a)); } static int8_t color_to_int8(const ColorGeometry4f &a) { |