github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/jit-bitset.h (about) 1 /* 2 * jit-bitset.h - Bitset routines for the JIT. 3 * 4 * Copyright (C) 2006 Southern Storm Software, Pty Ltd. 5 * 6 * This file is part of the libjit library. 7 * 8 * The libjit library is free software: you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public License 10 * as published by the Free Software Foundation, either version 2.1 of 11 * the License, or (at your option) any later version. 12 * 13 * The libjit library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with the libjit library. If not, see 20 * <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef _JIT_BITSET_H 24 #define _JIT_BITSET_H 25 26 #define _JIT_BITSET_WORD_BITS (8 * sizeof(_jit_bitset_word_t)) 27 28 typedef unsigned long _jit_bitset_word_t; 29 typedef struct _jit_bitset _jit_bitset_t; 30 31 /* TODO: Use less space. Perhaps borrow bitmap from gcc. */ 32 struct _jit_bitset 33 { 34 int size; 35 _jit_bitset_word_t *bits; 36 }; 37 38 void _jit_bitset_init(_jit_bitset_t *bs); 39 int _jit_bitset_allocate(_jit_bitset_t *bs, int size); 40 int _jit_bitset_is_allocated(_jit_bitset_t *bs); 41 void _jit_bitset_free(_jit_bitset_t *bs); 42 void _jit_bitset_set_bit(_jit_bitset_t *bs, int bit); 43 void _jit_bitset_clear_bit(_jit_bitset_t *bs, int bit); 44 int _jit_bitset_test_bit(_jit_bitset_t *bs, int bit); 45 void _jit_bitset_clear(_jit_bitset_t *bs); 46 int _jit_bitset_empty(_jit_bitset_t *bs); 47 void _jit_bitset_add(_jit_bitset_t *dest, _jit_bitset_t *src); 48 void _jit_bitset_sub(_jit_bitset_t *dest, _jit_bitset_t *src); 49 int _jit_bitset_copy(_jit_bitset_t *dest, _jit_bitset_t *src); 50 int _jit_bitset_equal(_jit_bitset_t *bs1, _jit_bitset_t *bs2); 51 52 #endif