1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * gmpy2_xmpz.h                                                            *
3  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4  * Python interface to the GMP or MPIR, MPFR, and MPC multiple precision   *
5  * libraries.                                                              *
6  *                                                                         *
7  * Copyright 2000 - 2009 Alex Martelli                                     *
8  *                                                                         *
9  * Copyright 2008 - 2021 Case Van Horsen                                   *
10  *                                                                         *
11  * This file is part of GMPY2.                                             *
12  *                                                                         *
13  * GMPY2 is free software: you can redistribute it and/or modify it under  *
14  * the terms of the GNU Lesser General Public License as published by the  *
15  * Free Software Foundation, either version 3 of the License, or (at your  *
16  * option) any later version.                                              *
17  *                                                                         *
18  * GMPY2 is distributed in the hope that it will be useful, but WITHOUT    *
19  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or   *
20  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public    *
21  * License for more details.                                               *
22  *                                                                         *
23  * You should have received a copy of the GNU Lesser General Public        *
24  * License along with GMPY2; if not, see <http://www.gnu.org/licenses/>    *
25  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26 
27 #ifndef GMPY_XMPZ_H
28 #define GMPY_XMPZ_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 static PyTypeObject XMPZ_Type;
35 #define XMPZ(obj) (((XMPZ_Object*)(obj))->z)
36 #define XMPZ_Check(v) (((PyObject*)v)->ob_type == &XMPZ_Type)
37 #define CHECK_MPZANY(v) (MPZ_Check(v) || XMPZ_Check(v))
38 
39 typedef struct {
40     PyObject_HEAD
41     XMPZ_Object *bitmap;
42     mp_bitcnt_t start, stop;
43     int iter_type;
44 } GMPy_Iter_Object;
45 
46 static PyTypeObject GMPy_Iter_Type;
47 #define GMPy_Iter_Check(v) (((PyObject*)v)->ob_type == &GMPy_Iter_Type)
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 #endif
53