mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-24 02:03:53 +08:00
fix(sdl): make sure minimal alignment is sizeof(void*) for aligned alloc (#6526)
This commit is contained in:
parent
70c562de16
commit
f36890102f
@ -442,7 +442,9 @@ static void * sdl_draw_buf_realloc_aligned(void * ptr, size_t new_size)
|
||||
|
||||
#ifndef _WIN32
|
||||
/* 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
|
||||
return _aligned_malloc(LV_ALIGN_UP(new_size, LV_DRAW_BUF_ALIGN), LV_DRAW_BUF_ALIGN);
|
||||
#endif /* _WIN32 */
|
||||
|
Loading…
Reference in New Issue
Block a user