/*****************************************************************************1# Copyright (C) 2007 William Stein <[email protected]>2#3# Distributed under the terms of the GNU General Public License (GPL)4# as published by the Free Software Foundation; either version 2 of5# the License, or (at your option) any later version.6# http://www.gnu.org/licenses/7#*****************************************************************************/89/* Author: Joel B. Mohler <[email protected]>102007-06-17 */1112#include "ZZ_pylong.h"13#include "ntl_wrap.h"14extern "C" {15#include "mpz_pylong.h"16}1718using namespace NTL;1920/* ZZ -> pylong conversion */21PyObject * ZZ_get_pylong(ZZ &z)22{23mpz_t temp;24PyObject *val;25mpz_init(temp);26ZZ_to_mpz( &temp, &z );27val = mpz_get_pylong( temp );28mpz_clear( temp );29return val;30}3132/* pylong -> ZZ conversion */33int ZZ_set_pylong(ZZ &z, PyObject * ll)34{35mpz_t temp;36mpz_init(temp);37mpz_set_pylong( temp, ll );38mpz_to_ZZ( &z, &temp );39mpz_clear( temp );40return 0;41}424344