/* BEGIN CSTYLED */
/*
* mpi.h
*
* Arbitrary precision integer arithmetic library
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the MPI Arbitrary Precision Integer Arithmetic library.
*
* The Initial Developer of the Original Code is
* Michael J. Fromberger.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Netscape Communications Corporation
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
*
* Sun elects to use this software under the MPL license.
*/
#ifndef _MPI_H
#define _MPI_H
/* $Id: mpi.h,v 1.22 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
#include "mpi-config.h"
#ifdef _KERNEL
#define labs(a) (a >= 0 ? a : -a)
/*
* Generic #define's to cover missing things in the kernel
*/
#ifndef isdigit
#endif
#ifndef isupper
#endif
#ifndef islower
#endif
#ifndef isalpha
#endif
#ifndef toupper
#endif
#ifndef tolower
#endif
#ifndef isspace
((x) == '\t') || ((x) == '\b'))
#endif
#endif /* _KERNEL */
#if MP_DEBUG
#endif
#if MP_IOFUNC
#include <stdio.h>
#include <ctype.h>
#endif
#ifndef _KERNEL
#include <limits.h>
#endif
#if defined(BSDI)
#endif
#if defined( macintosh )
#include <Types.h>
#elif defined( _WIN32_WCE)
#else
#endif
#define MP_ZPOS 0
typedef unsigned int mp_sign;
typedef unsigned int mp_size;
typedef int mp_err;
typedef int mp_flag;
#if !defined(ULONG_MAX)
#error "ULONG_MAX not defined"
#error "UINT_MAX not defined"
#error "USHRT_MAX not defined"
#endif
#if defined(ULONG_LONG_MAX) /* GCC, HPUX */
/* MP_ULONG_LONG_MAX was defined to be ULLONG_MAX */
#endif
/* We only use unsigned long for mp_digit iff long is more than 32 bits. */
typedef unsigned long mp_digit;
typedef unsigned long long mp_digit;
#else
typedef unsigned int mp_digit;
#endif
#if !defined(MP_NO_MP_WORD)
#if defined(MP_USE_UINT_DIGIT) && \
typedef unsigned long mp_word;
typedef long mp_sword;
#else
typedef unsigned long long mp_word;
typedef long long mp_sword;
#endif
#else
#endif
#endif /* !defined(MP_NO_MP_WORD) */
#if !defined(MP_WORD_MAX) && defined(MP_DEFINE_SMALL_WORD)
typedef unsigned int mp_word;
typedef int mp_sword;
#endif
#ifndef CHAR_BIT
#endif
/* MP_HALF_RADIX really ought to be called MP_SQRT_RADIX, but it's named
** MP_HALF_RADIX because it's the radix for MP_HALF_DIGITs, and it's
** consistent with the other _HALF_ names.
*/
/* Macros for accessing the mp_int internals */
/* This defines the maximum I/O base (minimum is 2) */
typedef struct {
} mp_int;
/* Default precision */
mp_size mp_get_prec(void);
/* Memory management */
/* Single digit arithmetic */
/* Sign manipulations */
/* Full arithmetic */
#if MP_SQUARE
#else
#endif
/* Modular arithmetic */
#if MP_MODARITH
#if MP_SQUARE
#else
#endif
#endif /* MP_MODARITH */
/* Comparisons */
/* Number theoretic */
#if MP_NUMTH
#endif /* end MP_NUMTH */
/* Input and output */
#if MP_IOFUNC
#endif /* end MP_IOFUNC */
/* Base conversion */
int mp_tovalue(char ch, int r);
/* Error strings */
/* Octet string conversion functions */
/* Miscellaneous */
#if defined(MP_API_COMPATIBLE)
#if MP_ARGCHK == 1
#define ARGCHK(X,Y) {if(!(X)){return (Y);}}
#ifdef _KERNEL
#else
#include <assert.h>
#endif
#else
#endif
#endif /* defined MP_API_COMPATIBLE */
#endif /* _MPI_H */
/* END CSTYLED */