packages feed

cao-0.1.1: backend_lib/C_generic/CAO_int.h

/*  CAO Compiler
    Copyright (C) 2014 Cryptography and Information Security Group, HASLab - INESC TEC and Universidade do Minho

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#ifndef CAO_INT_H
#define CAO_INT_H

#include "CAO_globals.h"
#include "CAO_bool.h"

#ifdef __cplusplus

#include <NTL/ZZ.h>
#include <iostream>

NTL_CLIENT

extern "C" {
#endif

	CAO_RES CAO_int_decl(CAO_int *);
	CAO_RES CAO_int_init(CAO_int, const char *);
	CAO_RES CAO_int_assign(CAO_int, CAO_int);
	CAO_RES CAO_int_assign_one(CAO_int);
	CAO_RES CAO_int_assign_zero(CAO_int);
	CAO_RES CAO_int_clone(CAO_int *, CAO_int);
	CAO_RES CAO_int_dispose(CAO_int);
	CAO_RES CAO_int_add(CAO_int, CAO_int, CAO_int);
	CAO_RES CAO_int_addTo(CAO_int, CAO_int);
	CAO_RES CAO_int_sub(CAO_int, CAO_int, CAO_int);
	CAO_RES CAO_int_subTo(CAO_int, CAO_int);
	CAO_RES CAO_int_sym(CAO_int, CAO_int);	
	CAO_RES CAO_int_mul(CAO_int, CAO_int, CAO_int);
	CAO_RES CAO_int_div(CAO_int, CAO_int, CAO_int);
	CAO_RES CAO_int_mod(CAO_int, CAO_int, CAO_int);

	CAO_RES CAO_int_pow(CAO_int, CAO_int, CAO_int);

	#define CAO_int_equal(a,b,c) a = _CAO_int_equal(b,c)
	CAO_bool _CAO_int_equal(CAO_int, CAO_int);
	#define CAO_int_nequal(a,b,c) a = _CAO_int_nequal(b,c)
	CAO_bool _CAO_int_nequal(CAO_int, CAO_int);
	#define CAO_int_lt(a,b,c) a = _CAO_int_lt(b,c)
	CAO_bool _CAO_int_lt(CAO_int, CAO_int);
	#define CAO_int_lte(a,b,c) a = _CAO_int_lte(b,c)
	CAO_bool _CAO_int_lte(CAO_int, CAO_int);
	#define CAO_int_gt(a,b,c) a = _CAO_int_gt(b,c)
	CAO_bool _CAO_int_gt(CAO_int, CAO_int);
	#define CAO_int_gte(a,b,c) a = _CAO_int_gte(b,c)
	CAO_bool _CAO_int_gte(CAO_int, CAO_int);

	CAO_RES CAO_int_dump(CAO_int);

	#define CAO_int_cast_rint(a,b) a = _CAO_int_cast_rint(b)
	CAO_rint _CAO_int_cast_rint(CAO_int);

#ifdef __cplusplus
}
#endif

#endif