[RenderScript] fix -Wimplicit-int-float-conversion
Fixes the warning:
frameworks/rs/cpu_ref/rsCpuRuntimeMath.cpp:102:10: error: implicit
conversion from 'int' to 'float' changes value from 2147483647 to
2147483648 [-Werror,-Wimplicit-int-float-conversion]
r /= RAND_MAX;
~~ ^~~~~~~~
The function is generating a random number, then dividing by RAND_MAX.
Precision isn't necessary here; make the cast explicit to silence the
warning.
Bug: 139945549
Test: mm
Change-Id: Iee14b6711b3fc36f99004b8bdaabf7c112e400d6
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
diff --git a/cpu_ref/rsCpuRuntimeMath.cpp b/cpu_ref/rsCpuRuntimeMath.cpp
index 29ea658..9f14e67 100644
--- a/cpu_ref/rsCpuRuntimeMath.cpp
+++ b/cpu_ref/rsCpuRuntimeMath.cpp
@@ -99,7 +99,7 @@
float SC_randf2(float min, float max) {
float r = (float)rand();
- r /= RAND_MAX;
+ r /= (float)RAND_MAX;
r = r * (max - min) + min;
return r;
}