<commit_before>//
//  AtomicSwift.h
//
//  Created by <NAME> on 12/7/15.
//  Copyright © 2015 <NAME>. Some rights reserved. Licensed under MIT.
//

#ifndef __BNR_ATOMIC_SHIMS__
#define __BNR_ATOMIC_SHIMS__

#include <stddef.h>
#include <sys/cdefs.h>
#include <stdint.h>
#include <stdbool.h>

#ifndef __has_feature
#define __has_feature(x) 0
#endif

#ifndef __has_extension
#define __has_extension(x) 0
#endif

#ifndef __has_attribute
#define __has_attribute(x) 0
#endif

#if __GNUC__
#if __has_attribute(swift_private)
#define BNR_ATOMIC_DECL        static __inline__ __attribute__((used, always_inline, swift_private))
#else
#define BNR_ATOMIC_DECL        static __inline__ __attribute__((used, always_inline))
#endif
#define BNR_ATOMIC_FASTPATH(x) ((typeof(x))__builtin_expect((long)(x), ~0l))
#else
#define BNR_ATOMIC_DECL        static inline
#define BNR_ATOMIC_FASTPATH(x) (x)
#endif

#if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
#define BNR_ATOMIC_ENUM(name, type, ...) typedef enum : type { __VA_ARGS__ } name##_t
#else
#define BNR_ATOMIC_ENUM(name, type, ...) enum { __VA_ARGS__ }; typedef type name##_t
#endif

BNR_ATOMIC_ENUM(bnr_atomic_memory_order, int32_t,
    bnr_atomic_memory_order_relaxed,
    bnr_atomic_memory_order_consume,
    bnr_atomic_memory_order_acquire,
    bnr_atomic_memory_order_release,
    bnr_atomic_memory_order_acq_rel,
    bnr_atomic_memory_order_seq_cst
);

#if __has_extension(c_atomic) && __has_extension(c_generic_selections)

#define __bnr_atomic_base(p) typeof(*_Generic((p), \
    volatile int16_t *: (int16_t *)(p), \
    volatile int32_t *: (int32_t *)(p), \
    volatile int64_t *: (int64_t *)(p), \
    default:            (void   **)(p) \
))

#define __bnr_cast_atomic(p) _Generic((p), \
    volatile int16_t *: (volatile _Atomic(int16_t) *)(p), \
    volatile int32_t *: (volatile _Atomic(int32_t) *)(p), \
    volatile int64_t *: (volatile _Atomic(int64_t) *)(p), \
    default:            (volatile _Atomic(void *)  *)(p) \
)

#define __bnr_atomic_load(ptr, model) \
    __c11_atomic_load(__bnr_cast_atomic(ptr), bnr_atomic_memory_order_##model)

#define __bnr_atomic_store(ptr, val, model) \
    __c11_atomic_store(__bnr_cast_atomic(ptr), val, bnr_atomic_memory_order_##model)

#define __bnr_atomic_compare_and_swap(ptr, expected, desired, model) ({ \
    __bnr_atomic_base(ptr) _expected = (expected); \
    __c11_atomic_compare_exchange_strong(__bnr_cast_atomic(ptr), &_expected, (desired), bnr_atomic_memory_order_##model, bnr_atomic_memory_order_relaxed); \<commit_msg>Cleanup imports in main header<commit_after>//
//  AtomicSwift.h
//
//  Created by <NAME> on 12/7/15.
//  Copyright © 2015 Big Nerd Ranch. Some rights reserved. Licensed under MIT.
//

#ifndef __BNR_ATOMIC_SHIMS__
#define __BNR_ATOMIC_SHIMS__

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

#ifndef __has_feature
#define __has_feature(x) 0
#endif

#ifndef __has_extension
#define __has_extension(x) 0
#endif

#ifndef __has_attribute
#define __has_attribute(x) 0
#endif

#if __GNUC__
#if __has_attribute(swift_private)
#define BNR_ATOMIC_DECL        static inline __attribute__((used, always_inline, swift_private))
#else
#define BNR_ATOMIC_DECL        static inline __attribute__((used, always_inline))
#endif
#define BNR_ATOMIC_FASTPATH(x) ((typeof(x))__builtin_expect((long)(x), ~0l))
#else
#define BNR_ATOMIC_DECL        static inline
#define BNR_ATOMIC_FASTPATH(x) (x)
#endif

#if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
#define BNR_ATOMIC_ENUM(name, type, ...) typedef enum : type { __VA_ARGS__ } name##_t
#else
#define BNR_ATOMIC_ENUM(name, type, ...) enum { __VA_ARGS__ }; typedef type name##_t
#endif

BNR_ATOMIC_ENUM(bnr_atomic_memory_order, int32_t,
    bnr_atomic_memory_order_relaxed,
    bnr_atomic_memory_order_consume,
    bnr_atomic_memory_order_acquire,
    bnr_atomic_memory_order_release,
    bnr_atomic_memory_order_acq_rel,
    bnr_atomic_memory_order_seq_cst
);

#if __has_extension(c_atomic) && __has_extension(c_generic_selections)

#define __bnr_atomic_base(p) typeof(*_Generic((p), \
    volatile int32_t *: (int32_t *)(p), \
    volatile int64_t *: (int64_t *)(p), \
    default:            (void   **)(p) \
))

#define __bnr_cast_atomic(p) _Generic((p), \
    volatile int32_t *: (volatile _Atomic(int32_t) *)(p), \
    volatile int64_t *: (volatile _Atomic(int64_t) *)(p), \
    default:            (volatile _Atomic(void *)  *)(p) \
)

#define __bnr_atomic_load(ptr, model) \
    __c11_atomic_load(__bnr_cast_atomic(ptr), bnr_atomic_memory_order_##model)

#define __bnr_atomic_store(ptr, val, model) \
    __c11_atomic_store(__bnr_cast_atomic(ptr), val, bnr_atomic_memory_order_##model)

#define __bnr_atomic_compare_and_swap(ptr, expected, desired, model) ({ \
    __bnr_atomic_base(ptr) _expected = (expected); \
    __c11_atomic_compare_exchange_strong(__bnr_cast_atomic(ptr), &_expected, (desired), bnr_atomic_memory_order_##model, bnr_atomic_memory_order_relaxed); \
{'fraction_non_alphanumeric': 0.1198959167333867, 'fraction_numerical': 0.016413130504403524, 'mean_word_length': 5.47279792746114, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '172691', 'n_tokens_mistral': 2010, 'n_tokens_neox': 1944, 'n_words': 347}