<commit_before>#ifndef BOOL_OPS_H
#define BOOL_OPS_H
/*
 * Functions to handle arithmetic operations on NumPy Bool values.
 */
#include <numpy/arrayobject.h>
#include <assert.h>

/*
 * A compiler time (ct) assert macro from 
 * http://www.pixelbeat.org/programming/gcc/static_assert.html
 * This is used to assure that npy_bool_wrapper is the right size.
 */
#define ct_assert(e) extern char (*ct_assert(void)) [sizeof(char[1 - 2*!(e)])]

class npy_bool_wrapper {
    public:
        char value;
        
        /* operators */
        operator char() const {
            if(value != 0) {
                return 1;
            } else {
                return 0;
            }
        }
        npy_bool_wrapper& operator=(const npy_bool_wrapper& x) {
            value = x;
            return (*this);
        }
        npy_bool_wrapper operator+(const npy_bool_wrapper& x) {
            return x || value ? 1 : 0;
        }
        /* inplace operators */
        npy_bool_wrapper operator+=(const npy_bool_wrapper& x) {
            value = x || value ? 1 : 0;
            return (*this);
        }
        npy_bool_wrapper operator*=(const npy_bool_wrapper& x) {
            value = value && x ? 1 : 0;
            return (*this);
        }
        /* constructors */
        npy_bool_wrapper() { 
            value = 0; 
        }
        template <class T>
        npy_bool_wrapper(T x) {
            value = x ? 1 : 0;
        }
};

ct_assert(sizeof(char) == sizeof(npy_bool_wrapper));

#endif<commit_msg>STY: Added parenthese for clarity as suggested by PV.<commit_after>#ifndef BOOL_OPS_H
#define BOOL_OPS_H
/*
 * Functions to handle arithmetic operations on NumPy Bool values.
 */
#include <numpy/arrayobject.h>
#include <assert.h>

/*
 * A compiler time (ct) assert macro from 
 * http://www.pixelbeat.org/programming/gcc/static_assert.html
 * This is used to assure that npy_bool_wrapper is the right size.
 */
#define ct_assert(e) extern char (*ct_assert(void)) [sizeof(char[1 - 2*!(e)])]

class npy_bool_wrapper {
    public:
        char value;
        
        /* operators */
        operator char() const {
            if(value != 0) {
                return 1;
            } else {
                return 0;
            }
        }
        npy_bool_wrapper& operator=(const npy_bool_wrapper& x) {
            value = x;
            return (*this);
        }
        npy_bool_wrapper operator+(const npy_bool_wrapper& x) {
            return (x || value) ? 1 : 0;
        }
        /* inplace operators */
        npy_bool_wrapper operator+=(const npy_bool_wrapper& x) {
            value = (x || value) ? 1 : 0;
            return (*this);
        }
        npy_bool_wrapper operator*=(const npy_bool_wrapper& x) {
            value = (value && x) ? 1 : 0;
            return (*this);
        }
        /* constructors */
        npy_bool_wrapper() { 
            value = 0; 
        }
        template <class T>
        npy_bool_wrapper(T x) {
            value = (x) ? 1 : 0;
        }
};

ct_assert(sizeof(char) == sizeof(npy_bool_wrapper));

#endif
{'fraction_non_alphanumeric': 0.11596091205211727, 'fraction_numerical': 0.009120521172638436, 'mean_word_length': 1.7867513611615244, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4993516', 'n_tokens_mistral': 999, 'n_tokens_neox': 938, 'n_words': 239}