android_memset.c: Use sanitized shifts
Avoid checks and traps on msb=1 unsigned shifts.
Change-Id: I5203a4290296b5557c0420ce0debad3b60d48233
diff --git a/libcutils/arch-mips/android_memset.c b/libcutils/arch-mips/android_memset.c
index 4164c2a..c0fe3d1 100644
--- a/libcutils/arch-mips/android_memset.c
+++ b/libcutils/arch-mips/android_memset.c
@@ -49,7 +49,7 @@
}
/* dst is now 32-bit-aligned */
/* fill body with 32-bit pairs */
- uint32_t value32 = (value << 16) | value;
+ uint32_t value32 = (((uint32_t)value) << 16) | ((uint32_t)value);
android_memset32((uint32_t*) dst, value32, size<<1);
if (size & 1) {
dst[size-1] = value; /* fill unpaired last elem */
@@ -76,7 +76,7 @@
}
/* dst is now 64-bit aligned */
/* fill body with 64-bit pairs */
- uint64_t value64 = (((uint64_t)value)<<32) | value;
+ uint64_t value64 = (((uint64_t)value) << 32) | ((uint64_t)value);
uint64_t* dst64 = (uint64_t*)dst;
while (size >= 12) {