0

i have this declaration in my c program

u_int64_t *x ;
x = (u_int64_t*)calloc(length, 8);

and want to replace it with an instruction that aligns the allocated 8-byte blocks to be able to use aligned AVX instructions such as vmovdqa and i used calloc because it initializes the blocks to 0 which is what i need. Any suggestions are welcome.

  • 3
    Related: https://stackoverflow.com/questions/23092621/why-is-there-no-aligned-calloc-in-c11 – chtz Jul 22 '20 at 17:42
  • 2
    Use `aligned_alloc`. Note that `vmovdqa` moves a 16 byte block. For an 8 byte block, 8 byte alignment is sufficient in all cases. – fuz Jul 22 '20 at 18:17

0 Answers0