| 1 | /* Define MALLOC_ALIGNMENT for malloc. Generic version. |
| 2 | Copyright (C) 2017-2023 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #ifndef _GENERIC_MALLOC_ALIGNMENT_H |
| 20 | #define _GENERIC_MALLOC_ALIGNMENT_H |
| 21 | |
| 22 | /* MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks. It |
| 23 | must be a power of two at least 2 * SIZE_SZ, even on machines for |
| 24 | which smaller alignments would suffice. It may be defined as larger |
| 25 | than this though. Note however that code and data structures are |
| 26 | optimized for the case of 8-byte alignment. */ |
| 27 | #define MALLOC_ALIGNMENT (2 * SIZE_SZ < __alignof__ (long double) \ |
| 28 | ? __alignof__ (long double) : 2 * SIZE_SZ) |
| 29 | |
| 30 | |
| 31 | #endif /* !defined(_GENERIC_MALLOC_ALIGNMENT_H) */ |
| 32 | |