Lines Matching full:alignment
10 // tests for the condition where the alignment is not a power of 2.
21 void *aligned_alloc(size_t alignment, size_t size);
25 size_t alignment = 1U << 12; in main() local
32 posix_memalign(&p, alignment, size); in main()
34 assert(((uintptr_t)p & (alignment - 1)) == 0); in main()
36 p = aligned_alloc(alignment, size); in main()
38 assert(((uintptr_t)p & (alignment - 1)) == 0); in main()
40 // Tests various combinations of alignment and sizes in main()
42 alignment = 1U << i; in main()
46 p = memalign(alignment, size - (2 * sizeof(void *) * k)); in main()
48 assert(((uintptr_t)p & (alignment - 1)) == 0); in main()
53 // For larger alignment, reduce the number of allocations to avoid running in main()
56 alignment = 1U << i; in main()
58 p = memalign(alignment, 0x1000 - (2 * sizeof(void *) * k)); in main()
60 assert(((uintptr_t)p & (alignment - 1)) == 0); in main()
66 // Alignment is not a power of 2. in main()
67 p = memalign(alignment - 1, size); in main()
68 // CHECK-align: Scudo ERROR: invalid allocation alignment in main()
70 // Size is not a multiple of alignment. in main()
71 p = aligned_alloc(alignment, size >> 1); in main()
75 // Alignment is not a power of 2. in main()
79 // Alignment is a power of 2, but not a multiple of size(void *). in main()