<commit_before>/*************************************************************************************[CircTypes.h]
Copyright (c) 2007, <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/

#ifndef Minisat_CircTypes_h
#define Minisat_CircTypes_h

#include "minisat/mtl/IntTypes.h"
#include "minisat/mtl/Vec.h"

namespace Minisat {

//=================================================================================================
// Helper types (analogues of Var/Lit types from MiniSat):

typedef enum { gtype_Inp = 0, gtype_And = 1, gtype_Const = 2 } GateType;

//-------------------------------------------------------------------------------------------------
// Gate-type: (analogue of MiniSat's Var)


// --- bit 0: type { 0 = inp, 1 = and }, 1 : unused, 2-31 data ---
struct Gate {
    unsigned int x;
    bool operator == (Gate p) const { return x == p.x; }
    bool operator != (Gate p) const { return x != p.x; }
    bool operator <  (Gate p) const { return x <  p.x; }
    bool operator <= (Gate p) const { return x <= p.x; }
    bool operator >  (Gate p) const { return x >  p.x; }
    bool operator >= (Gate p) const { return x >= p.x; }
};

const Gate gate_Undef = { ((1U << 30)-1) << 2 };
const Gate gate_True  = { 0 };

// Use this as a constructor:
inline Gate         mkGate  (unsigned int id, GateType t){ Gate g; g.x = (id << 2) + t; return g; }
inline GateType     type    (Gate g){ return g == gate_True ? gtype_Const : GateType(g.x & 1); }

// Note! Use GMap instead of this:
inline unsigned int index (Gate g) { return g.x >> 2; }

//-------------------------------------------------------------------------------------------------
// Signal-type: (analogue of MiniSat's Lit)

// --- bit 0: type { 0 = inp, 1 = and }, 1 : sign, 2-31 data ---
struct Sig {
    unsigned int x;
    bool operator == (Sig p) const { return x == p.x; }
    bool operator != (Sig p) const { return x != p.x; }
    bool operator <  (Sig p) const { return x <  p.x; } // '<' makes p, ~p adjacent in the ordering.
    bool operator <= (Sig p) const { return x <= p.x; }
    bool operator >  (Sig p) const { return x >  p.x; }
    bool operator >= (Sig p) const { return x >= p.x; }
};<commit_msg>Fix 'mkGate()' to also work for constant true.<commit_after>/*************************************************************************************[CircTypes.h]
Copyright (c) 2007, <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/

#ifndef Minisat_CircTypes_h
#define Minisat_CircTypes_h

#include "minisat/mtl/IntTypes.h"
#include "minisat/mtl/Vec.h"

namespace Minisat {

//=================================================================================================
// Helper types (analogues of Var/Lit types from MiniSat):

typedef enum { gtype_Inp = 0, gtype_And = 1, gtype_Const = 2 } GateType;

//-------------------------------------------------------------------------------------------------
// Gate-type: (analogue of MiniSat's Var)


// --- bit 0: type { 0 = inp, 1 = and }, 1 : unused, 2-31 data ---
struct Gate {
    unsigned int x;
    bool operator == (Gate p) const { return x == p.x; }
    bool operator != (Gate p) const { return x != p.x; }
    bool operator <  (Gate p) const { return x <  p.x; }
    bool operator <= (Gate p) const { return x <= p.x; }
    bool operator >  (Gate p) const { return x >  p.x; }
    bool operator >= (Gate p) const { return x >= p.x; }
};

const Gate gate_Undef = { ((1U << 30)-1) << 2 };
const Gate gate_True  = { 0 };

// Use this as a constructor:
inline Gate         mkGate  (unsigned int id, GateType t){
    Gate g; g.x = (id << 2) + (unsigned int)(t == gtype_And); return g; }
inline GateType     type    (Gate g){ return g == gate_True ? gtype_Const : GateType(g.x & 1); }

// Note! Use GMap instead of this:
inline unsigned int index (Gate g) { return g.x >> 2; }

//-------------------------------------------------------------------------------------------------
// Signal-type: (analogue of MiniSat's Lit)

// --- bit 0: type { 0 = inp, 1 = and }, 1 : sign, 2-31 data ---
struct Sig {
    unsigned int x;
    bool operator == (Sig p) const { return x == p.x; }
    bool operator != (Sig p) const { return x != p.x; }
    bool operator <  (Sig p) const { return x <  p.x; } // '<' makes p, ~p adjacent in the ordering.
    bool operator <= (Sig p) const { return x <= p.x; }
    bool operator >  (Sig p) const { return x >  p.x; }
    bool operator >= (Sig p) const { return x >= p.x; }
};
{'fraction_non_alphanumeric': 0.24153055051421657, 'fraction_numerical': 0.009074410163339383, 'mean_word_length': 2.809331797235023, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 25, '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': '297576', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1766, 'n_words': 801}