Explorar o código

memalign(): assert that alignment is a power of two

Ioannis Koutras %!s(int64=12) %!d(string=hai) anos
pai
achega
34804ddc3d
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/memalign.c

+ 2 - 0
src/memalign.c

@@ -54,6 +54,8 @@ void *memalign(size_t alignment, size_t size) {
     DEFAULT_RB_T *encapsulated_rb;
     raw_block_header_t *raw_block;
 
+    assert((alignment & 1) == 0);
+
     memptr = NULL;
 
     /* Search the available freelist-organized raw blocks for a block whose size