Home
last modified time | relevance | path

Searched refs:alignment (Results 1 – 24 of 24) sorted by relevance

/bionic/benchmarks/tests/
Dbenchmark_test.cpp22 for (size_t alignment = 1; alignment <= 32; alignment *= 2) { in TEST() local
23 for (size_t or_mask = 0; or_mask < alignment; ++or_mask) { in TEST()
24 uintptr_t aligned_ptr = reinterpret_cast<uintptr_t>(GetAlignedMemory(buf.data(), alignment, in TEST()
26 ASSERT_EQ(aligned_ptr % alignment, or_mask); in TEST()
27 ASSERT_EQ(aligned_ptr & alignment, alignment); in TEST()
34 for (size_t alignment = 1; alignment <= 2048; alignment *= 2) { in TEST() local
35 uintptr_t aligned_ptr = reinterpret_cast<uintptr_t>(GetAlignedPtr(&buf, alignment, 100)); in TEST()
36 ASSERT_EQ(aligned_ptr & alignment, alignment); in TEST()
37 ASSERT_EQ(aligned_ptr & (alignment - 1), 0u); in TEST()
/bionic/benchmarks/
Dutil.cpp26 char *GetAlignedMemory(char *orig_ptr, size_t alignment, size_t or_mask) { in GetAlignedMemory() argument
27 if ((alignment & (alignment - 1)) != 0) { in GetAlignedMemory()
31 if (or_mask > alignment) { in GetAlignedMemory()
36 if (alignment > 0) { in GetAlignedMemory()
40 ptr += alignment - (ptr & (alignment - 1)); in GetAlignedMemory()
41 ptr |= alignment | or_mask; in GetAlignedMemory()
47 char *GetAlignedPtr(std::vector<char>* buf, size_t alignment, size_t nbytes) { in GetAlignedPtr() argument
48 buf->resize(nbytes + 3 * alignment); in GetAlignedPtr()
49 return GetAlignedMemory(buf->data(), alignment, 0); in GetAlignedPtr()
52 char *GetAlignedPtrFilled(std::vector<char>* buf, size_t alignment, size_t nbytes, char fill_byte) { in GetAlignedPtrFilled() argument
[all …]
Dutil.h23 char *GetAlignedMemory(char *orig_ptr, size_t alignment, size_t or_mask);
25 char *GetAlignedPtr(std::vector<char>* buf, size_t alignment, size_t nbytes);
27 char *GetAlignedPtrFilled(std::vector<char>* buf, size_t alignment, size_t nbytes, char fill_byte);
Dstring_benchmark.cpp100 const size_t alignment = state.range(1); in BM_string_memmove_overlap_dst_before_src() local
102 std::vector<char> buf(3 * alignment + nbytes + 1, 'x'); in BM_string_memmove_overlap_dst_before_src()
103 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_memmove_overlap_dst_before_src()
115 const size_t alignment = state.range(1); in BM_string_memmove_overlap_src_before_dst() local
118 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_memmove_overlap_src_before_dst()
130 const size_t alignment = state.range(1); in BM_string_memset() local
133 char* buf_aligned = GetAlignedPtr(&buf, alignment, nbytes + 1); in BM_string_memset()
145 const size_t alignment = state.range(1); in BM_string_strlen() local
148 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_strlen()
/bionic/tests/libs/
Dbionic_tests_zipalign.cpp68 static bool CreateAlignedZip(ZipArchiveHandle& handle, FILE* zip_dst, uint32_t alignment) { in CreateAlignedZip() argument
88 error = writer.StartAlignedEntry(zip_name.c_str(), flags, alignment); in CreateAlignedZip()
128 unsigned long int alignment = strtoul(argv[1], &end, 10); in main() local
129 if ((alignment == ULONG_MAX && errno == ERANGE) || *end != '\0') { in main()
134 if (((alignment - 1) & alignment) != 0) { in main()
154 bool success = CreateAlignedZip(handle, zip_dst, static_cast<uint32_t>(alignment)); in main()
/bionic/libc/private/
Dbionic_macros.h43 #define BIONIC_ALIGN(value, alignment) \ argument
44 (((value) + (alignment) - 1) & ~((alignment) - 1))
/bionic/libc/malloc_debug/
Dmalloc_debug.cpp76 void* debug_memalign(size_t alignment, size_t bytes);
81 int debug_posix_memalign(void** memptr, size_t alignment, size_t size);
412 void* debug_memalign(size_t alignment, size_t bytes) { in debug_memalign() argument
414 return g_dispatch->memalign(alignment, bytes); in debug_memalign()
430 if (!powerof2(alignment)) { in debug_memalign()
431 alignment = BIONIC_ROUND_UP_POWER_OF_2(alignment); in debug_memalign()
435 if (alignment < MINIMUM_ALIGNMENT_BYTES) { in debug_memalign()
436 alignment = MINIMUM_ALIGNMENT_BYTES; in debug_memalign()
442 size_t real_size = alignment + bytes + g_debug->extra_bytes(); in debug_memalign()
456 value += (-value % alignment); in debug_memalign()
[all …]
DRecordData.cpp90 MemalignEntry::MemalignEntry(void* pointer, size_t size, size_t alignment) in MemalignEntry() argument
91 : MallocEntry(pointer, size), alignment_(alignment) { in MemalignEntry()
DRecordData.h135 MemalignEntry(void* pointer, size_t size, size_t alignment);
DREADME.md292 pointer = memalign(alignment, size)
294 **THREAD\_ID**: memalign pointer alignment size
296 posix\_memalign(&pointer, alignment, size)
298 **THREAD\_ID**: memalign pointer alignment size
/bionic/tests/
Dmalloc_test.cpp79 for (size_t alignment = 1 << i; alignment < (1U << (i+1)); alignment++) { in TEST() local
80 char *ptr = reinterpret_cast<char*>(memalign(alignment, 100)); in TEST()
81 ASSERT_TRUE(ptr != NULL) << "Failed at alignment " << alignment; in TEST()
82 ASSERT_LE(100U, malloc_usable_size(ptr)) << "Failed at alignment " << alignment; in TEST()
84 << "Failed at alignment " << alignment; in TEST()
105 for (size_t alignment = 1; alignment <= 4096; alignment <<= 1) { in TEST() local
106 char *ptr = (char*)memalign(alignment, 100); in TEST()
109 ASSERT_EQ(0U, (intptr_t)ptr % alignment); in TEST()
Dbuffer_tests.cpp195 static void *GetAlignedPtr(void *orig_ptr, int alignment, int or_mask) { in GetAlignedPtr() argument
197 if (alignment > 0) { in GetAlignedPtr()
201 ptr += alignment - (ptr & (alignment - 1)); in GetAlignedPtr()
202 ptr |= alignment | or_mask; in GetAlignedPtr()
Dpthread_test.cpp1783 void* allocate(size_t size, size_t alignment) { in allocate() argument
1784 char* p = new char[size + alignment * 2]; in allocate()
1786 while (!is_strict_aligned(p, alignment)) { in allocate()
1799 bool is_strict_aligned(char* p, size_t alignment) { in is_strict_aligned() argument
1800 return (reinterpret_cast<uintptr_t>(p) % (alignment * 2)) == alignment; in is_strict_aligned()
/bionic/libc/bionic/
Dmalloc_common.cpp129 extern "C" void* memalign(size_t alignment, size_t bytes) { in memalign() argument
132 return _memalign(alignment, bytes); in memalign()
134 return Malloc(memalign)(alignment, bytes); in memalign()
137 extern "C" int posix_memalign(void** memptr, size_t alignment, size_t size) { in posix_memalign() argument
140 return _posix_memalign(memptr, alignment, size); in posix_memalign()
142 return Malloc(posix_memalign)(memptr, alignment, size); in posix_memalign()
/bionic/libc/include/
Dmalloc.h38 void* memalign(size_t alignment, size_t byte_count) __mallocfunc __BIONIC_ALLOC_SIZE(2) __wur;
Dstdlib.h75 int posix_memalign(void** memptr, size_t alignment, size_t size) __INTRODUCED_IN(16);
/bionic/libc/kernel/uapi/mtd/
Dubi-user.h61 __s32 alignment; member
/bionic/libc/malloc_debug/tests/
Dmalloc_debug_unit_tests.cpp324 for (size_t alignment = 1; alignment <= 256; alignment++) { in TEST_F() local
325 pointer = reinterpret_cast<uint8_t*>(debug_memalign(alignment, 100)); in TEST_F()
328 size_t alignment_mask = alignment - 1; in TEST_F()
329 if (!powerof2(alignment)) { in TEST_F()
330 alignment_mask = BIONIC_ROUND_UP_POWER_OF_2(alignment) - 1; in TEST_F()
416 for (size_t alignment = 1; alignment <= 256; alignment++) { in TEST_F() local
417 pointer = reinterpret_cast<uint8_t*>(debug_memalign(alignment, 100)); in TEST_F()
421 size_t alignment_mask = alignment - 1; in TEST_F()
422 if (!powerof2(alignment)) { in TEST_F()
423 alignment_mask = BIONIC_ROUND_UP_POWER_OF_2(alignment) - 1; in TEST_F()
[all …]
/bionic/libc/kernel/uapi/drm/
Di915_drm.h303 int alignment; member
396 __u64 alignment; member
413 __u64 alignment; member
470 __u64 alignment; member
Dradeon_drm.h560 int alignment; member
614 __u64 alignment; member
Damdgpu_drm.h64 __u64 alignment; member
/bionic/linker/
Dlinker_phdr.h68 bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
Dlinker_phdr.cpp290 bool ElfReader::CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment) { in CheckFileRange() argument
303 ((offset % alignment) == 0); in CheckFileRange()
/bionic/
Dandroid-changes-for-ndk-developers.md112 Current versions of the zipalign tool take care of alignment.