From 20b859833cff326a98ed501d7f73d5f0f3017825 Mon Sep 17 00:00:00 2001 From: James Zern Date: Sat, 27 Aug 2016 10:34:40 -0700 Subject: [PATCH] aom_mem,align_addr: use ~ to create mask removes the need for an intermediate cast to int, which was missing in the call added in: 73a3fd4 aom_mem: Refactor code quiets a visual studio warning: C4146: unary minus operator applied to unsigned type, result still unsigned Change-Id: I76c4003416759c6c76b78f74de7c0d2ba5071216 --- aom_mem/aom_mem.c | 2 +- aom_mem/include/aom_mem_intrnl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aom_mem/aom_mem.c b/aom_mem/aom_mem.c index 144085f22..4514fb54a 100644 --- a/aom_mem/aom_mem.c +++ b/aom_mem/aom_mem.c @@ -42,7 +42,7 @@ void *aom_memalign(size_t align, size_t size) { const size_t aligned_size = GetAlignedMallocSize(size, align); void *const addr = malloc(aligned_size); if (addr) { - x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, (int)align); + x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, align); SetActualMallocAddress(x, addr); } return x; diff --git a/aom_mem/include/aom_mem_intrnl.h b/aom_mem/include/aom_mem_intrnl.h index 2e96fa464..3cdfbe08d 100644 --- a/aom_mem/include/aom_mem_intrnl.h +++ b/aom_mem/include/aom_mem_intrnl.h @@ -27,6 +27,6 @@ /*returns an addr aligned to the byte boundary specified by align*/ #define align_addr(addr, align) \ - (void *)(((size_t)(addr) + ((align)-1)) & (size_t) - (align)) + (void *)(((size_t)(addr) + ((align)-1)) & ~(size_t)((align)-1)) #endif // AOM_MEM_INCLUDE_AOM_MEM_INTRNL_H_