android_memset.c: Use __attribute__((no_sanitize("integer")))
Turn off integer sanitization on android_memset. memset()ing is expected to be a fast operation. Avoid the use of the "while (size--) { }" construct, which harmlessly underflows. Change-Id: Ia61ff2323c759bf52df7e70b8be2fae0b0366dda
This commit is contained in:
parent
f306812303
commit
d9eda62875
|
@ -30,6 +30,9 @@
|
|||
|
||||
#include <cutils/memory.h>
|
||||
|
||||
#ifdef __clang__
|
||||
__attribute__((no_sanitize("integer")))
|
||||
#endif
|
||||
void android_memset16(uint16_t* dst, uint16_t value, size_t size)
|
||||
{
|
||||
/* optimized version of
|
||||
|
@ -54,6 +57,9 @@ void android_memset16(uint16_t* dst, uint16_t value, size_t size)
|
|||
}
|
||||
|
||||
|
||||
#ifdef __clang__
|
||||
__attribute__((no_sanitize("integer")))
|
||||
#endif
|
||||
void android_memset32(uint32_t* dst, uint32_t value, size_t size)
|
||||
{
|
||||
/* optimized version of
|
||||
|
@ -86,7 +92,8 @@ void android_memset32(uint32_t* dst, uint32_t value, size_t size)
|
|||
|
||||
/* fill remainder with original 32-bit single-elem loop */
|
||||
dst = (uint32_t*) dst64;
|
||||
while (size--) {
|
||||
while (size != 0) {
|
||||
size--;
|
||||
*dst++ = value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue