<commit_before>#ifndef PALIGNED_ALLOC_H

#ifndef __cplusplus

/*
 * NOTE: MSVC in general has no aligned alloc function that is
 * compatible with free and it is not trivial to implement a version
 * there is. Therefore, to remain portable, end user code needs to
 * use `aligned_free` which is not part of C11 but defined in this header.
 *
 * The same issue may be present on some Unix systems not providing
 * posix_memalign, but we do not currently support this.
 *
 * For C11 compliant compilers and compilers with posix_memalign,
 * it is valid to use free instead of aligned_free with the above
 * caveats.
 */

#include <stdlib.h>


/*
 * Define this to see which version is used so the fallback is not
 * enganged unnecessarily:
 *
 * #define PORTABLE_DEBUG_ALIGNED_ALLOC
 */

#if !defined(PORTABLE_C11_ALIGNED_ALLOC)

#if defined (__GLIBC__) && defined (_ISOC11_SOURCE)
#define PORTABLE_C11_ALIGNED_ALLOC 1
#elif defined(__clang__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif defined(__IBMC__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
#define PORTABLE_C11_ALIGNED_ALLOC 1
#else
#define PORTABLE_C11_ALIGNED_ALLOC 0
#endif

#endif /* PORTABLE_C11_ALIGNED_ALLOC */

/* https://linux.die.net/man/3/posix_memalign */
#if !defined(PORTABLE_POSIX_MEMALIGN)
/* https://forum.kde.org/viewtopic.php?p=66274 */
#if (defined _GNU_SOURCE) || ((_XOPEN_SOURCE + 0) >= 600) || (_POSIX_C_SOURCE + 0) >= 200112L 
#define PORTABLE_POSIX_MEMALIGN 1
#elif (__clang__)
#define PORTABLE_POSIX_MEMALIGN 1
#else
#define PORTABLE_POSIX_MEMALIGN 0<commit_msg>Improve aligned_alloc platform detection<commit_after>#ifndef PALIGNED_ALLOC_H

#ifndef __cplusplus

/*
 * NOTE: MSVC in general has no aligned alloc function that is
 * compatible with free and it is not trivial to implement a version
 * there is. Therefore, to remain portable, end user code needs to
 * use `aligned_free` which is not part of C11 but defined in this header.
 *
 * The same issue may be present on some Unix systems not providing
 * posix_memalign, but we do not currently support this.
 *
 * For C11 compliant compilers and compilers with posix_memalign,
 * it is valid to use free instead of aligned_free with the above
 * caveats.
 */

#include <stdlib.h>


/*
 * Define this to see which version is used so the fallback is not
 * enganged unnecessarily:
 *
 * #define PORTABLE_DEBUG_ALIGNED_ALLOC
 */

#if !defined(PORTABLE_C11_ALIGNED_ALLOC)

#if defined (__GLIBC__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif defined (__clang__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif defined(__IBMC__)
#define PORTABLE_C11_ALIGNED_ALLOC 0
#elif (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
#define PORTABLE_C11_ALIGNED_ALLOC 1
#else
#define PORTABLE_C11_ALIGNED_ALLOC 0
#endif

#endif /* PORTABLE_C11_ALIGNED_ALLOC */

/* https://linux.die.net/man/3/posix_memalign */
#if !defined(PORTABLE_POSIX_MEMALIGN)
/* https://forum.kde.org/viewtopic.php?p=66274 */
#if (defined _GNU_SOURCE) || ((_XOPEN_SOURCE + 0) >= 600) || (_POSIX_C_SOURCE + 0) >= 200112L 
#define PORTABLE_POSIX_MEMALIGN 1
#elif (__clang__)
#define PORTABLE_POSIX_MEMALIGN 1
#else
#define PORTABLE_POSIX_MEMALIGN 0
{'fraction_non_alphanumeric': 0.08679706601466992, 'fraction_numerical': 0.030562347188264057, 'mean_word_length': 5.222433460076045, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3819150', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1085, 'n_words': 345}