mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-31 07:56:23 +08:00
fix(sdl): make sure minimal alignment is sizeof(void*) for aligned alloc (#6526)
This commit is contained in:
@@ -442,7 +442,9 @@ static void * sdl_draw_buf_realloc_aligned(void * ptr, size_t new_size)
|
|||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
/* Size must be multiple of align, See: https://en.cppreference.com/w/c/memory/aligned_alloc */
|
/* Size must be multiple of align, See: https://en.cppreference.com/w/c/memory/aligned_alloc */
|
||||||
return aligned_alloc(LV_DRAW_BUF_ALIGN, LV_ALIGN_UP(new_size, LV_DRAW_BUF_ALIGN));
|
|
||||||
|
#define BUF_ALIGN (LV_DRAW_BUF_ALIGN < sizeof(void *) ? sizeof(void *) : LV_DRAW_BUF_ALIGN)
|
||||||
|
return aligned_alloc(BUF_ALIGN, LV_ALIGN_UP(new_size, BUF_ALIGN));
|
||||||
#else
|
#else
|
||||||
return _aligned_malloc(LV_ALIGN_UP(new_size, LV_DRAW_BUF_ALIGN), LV_DRAW_BUF_ALIGN);
|
return _aligned_malloc(LV_ALIGN_UP(new_size, LV_DRAW_BUF_ALIGN), LV_DRAW_BUF_ALIGN);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|||||||
Reference in New Issue
Block a user