diff --git a/vpx_mem/include/vpx_mem_intrnl.h b/vpx_mem/include/vpx_mem_intrnl.h index b62d238fd..2c259d322 100644 --- a/vpx_mem/include/vpx_mem_intrnl.h +++ b/vpx_mem/include/vpx_mem_intrnl.h @@ -26,6 +26,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 // VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_ diff --git a/vpx_mem/vpx_mem.c b/vpx_mem/vpx_mem.c index 4f4e0dddf..138a5402e 100644 --- a/vpx_mem/vpx_mem.c +++ b/vpx_mem/vpx_mem.c @@ -59,7 +59,7 @@ void *vpx_memalign(size_t align, size_t size) { addr = malloc((size_t)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); set_actual_malloc_address(x, addr); } return x;