Merge "android_memset.c: Use sanitized shifts"

This commit is contained in:
Nick Kralevich 2015-08-27 23:17:22 +00:00 committed by Gerrit Code Review
commit f4355868cb
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ void android_memset16(uint16_t* dst, uint16_t value, size_t size)
}
/* 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 @@ void android_memset32(uint32_t* dst, uint32_t value, size_t size)
}
/* 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) {