00001 /* --------------------------------------------------------------------------- 00002 00003 00004 This file is part of the ``utils/bignumbers'' package of NuSMV version 2. 00005 Copyright (C) 2012 by FBK-irst. 00006 00007 NuSMV version 2 is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 NuSMV version 2 is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 00021 For more information on NuSMV see <http://nusmv.fbk.eu> 00022 or email to <nusmv-users@fbk.eu>. 00023 Please report bugs to <nusmv-users@fbk.eu>. 00024 00025 To contact the NuSMV development board, email to <nusmv@fbk.eu>. 00026 00027 -----------------------------------------------------------------------------*/ 00028 00039 #ifndef __NUSMV_CORE_UTILS_BIGNUMBERS_BVNUMBERS_INT_H__ 00040 00046 #define __NUSMV_CORE_UTILS_BIGNUMBERS_BVNUMBERS_INT_H__ 00047 00048 #include "nusmv/core/utils/bignumbers/numbersInt.h" 00049 #include <limits.h> 00050 00051 /*---------------------------------------------------------------------------*/ 00052 /* Constant declarations */ 00053 /*---------------------------------------------------------------------------*/ 00054 00055 /*---------------------------------------------------------------------------*/ 00056 /* Type declarations */ 00057 /*---------------------------------------------------------------------------*/ 00058 00059 /*---------------------------------------------------------------------------*/ 00060 /* Stucture declarations */ 00061 /*---------------------------------------------------------------------------*/ 00062 00063 /*---------------------------------------------------------------------------*/ 00064 /* Variable declarations */ 00065 /*---------------------------------------------------------------------------*/ 00066 00067 /*---------------------------------------------------------------------------*/ 00068 /* Macro declarations */ 00069 /*---------------------------------------------------------------------------*/ 00070 00073 /*---------------------------------------------------------------------------*/ 00074 /* Function prototypes */ 00075 /*---------------------------------------------------------------------------*/ 00076 00077 boolean BVQNumber_fits(const QNumber* n, size_t num_bits); 00078 00079 boolean BVQNumber_is_pow2(const QNumber* n, size_t* out_n); 00080 00081 QNumber BVQNumber_twos_complement(const QNumber* n, size_t num_bits); 00082 00083 QNumber BVQNumber_pow2(size_t n); 00084 00085 /* bit-manipulating functions */ 00086 boolean BVQNumber_test_bit(const QNumber* n, size_t index); 00087 00088 void BVQNumber_set_bit(QNumber* n, size_t index, int value); 00089 00090 QNumber BVQNumber_bit_and(const QNumber* n1, const QNumber* n2); 00091 00092 QNumber BVQNumber_bit_or(const QNumber* n1, const QNumber* n2); 00093 00094 QNumber BVQNumber_bit_xor(const QNumber* n1, const QNumber* n2); 00095 00096 QNumber BVQNumber_bit_complement(const QNumber* n); 00097 00098 QNumber BVQNumber_bit_left_shift(const QNumber* n, size_t i); 00099 00100 QNumber BVQNumber_bit_right_shift(const QNumber* n, size_t i); 00101 00102 size_t BVQNumber_scan_bit_1(const QNumber* n, size_t start_index); 00103 00104 boolean BVQNumber_to_long(const QNumber* n, long* out); 00105 00106 void BVQNumber_check_bv(const QNumber* n); 00107 00108 long BVQNumber_bit_and_l(long a, long b); 00109 00110 long BVQNumber_bit_or_l(long a, long b); 00111 00112 long BVQNumber_bit_xor_l(long a, long b); 00113 00114 size_t get_max_size_t_value(void); 00115 00118 #endif /* __NUSMV_CORE_UTILS_BIGNUMBERS_BVNUMBERS_INT_H__ */