mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-24 05:45:59 +08:00
[fix] use aligned_alloc only if glibc >= 2.16 (#2598)
This commit is contained in:
committed by
GitHub
parent
9ace12432c
commit
f8f4142f6b
@@ -60,8 +60,12 @@ void image_create(struct image_t *img, uint16_t width, uint16_t height, enum ima
|
||||
img->buf_size = sizeof(uint8_t) * width * height;
|
||||
}
|
||||
|
||||
#if __GLIBC__ > 2 || (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 16)
|
||||
// aligned memory slightly speeds up any later copies
|
||||
img->buf = aligned_alloc(CACHE_LINE_LENGTH, img->buf_size + (CACHE_LINE_LENGTH - img->buf_size % CACHE_LINE_LENGTH) % CACHE_LINE_LENGTH);
|
||||
#else
|
||||
img->buf = malloc(img->buf_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user