Lines Matching refs:alignment

47 // Default memory alignment of malloc.
101 // Allocate memory with a specific alignment and return that pointer.
102 // This function assumes an alignment value that is a power of 2.
103 // If the alignment is 0, then use the pointer returned by malloc.
104 uint8_t *getAlignedMemory(uint8_t *orig_ptr, int alignment, int or_mask) {
107 if (alignment > 0) {
108 // When setting the alignment, set it to exactly the alignment chosen.
111 ptr += alignment - (ptr & (alignment - 1));
112 ptr |= alignment | or_mask;
118 // Allocate memory with a specific alignment and return that pointer.
119 // This function assumes an alignment value that is a power of 2.
120 // If the alignment is 0, then use the pointer returned by malloc.
121 uint8_t *allocateAlignedMemory(size_t size, int alignment, int or_mask) {
122 uint64_t ptr = reinterpret_cast<uint64_t>(malloc(size + 3 * alignment));
125 return getAlignedMemory((uint8_t*)ptr, alignment, or_mask);
164 // needed between each buffer so that each one is aligned to "alignment".
165 int getAlignmentIncrement(size_t size, int alignment) {
166 if (alignment == 0) {
167 alignment = DEFAULT_MALLOC_MEMORY_ALIGNMENT;
169 alignment *= 2;
170 return size + alignment - (size % alignment);
173 uint8_t *getColdBuffer(int num_buffers, size_t incr, int alignment, int or_mask) {
174 uint8_t *buffers = reinterpret_cast<uint8_t*>(malloc(num_buffers * incr + 3 * alignment));
178 return getAlignedMemory(buffers, alignment, or_mask);
268 // alignment. The variable "buf" will be a pointer to the buffer and should
306 // and alignment. In order to avoid any algorithms that prefetch past the end