tclTomMath.h File Reference

#include <tclTomMathDecls.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include <tommath_class.h>

Go to the source code of this file.

Data Structures

struct  mp_int

Defines

#define MODULE_SCOPE   extern
#define MIN(x, y)   ((x)<(y)?(x):(y))
#define MAX(x, y)   ((x)>(y)?(x):(y))
#define OPT_CAST(x)
#define DIGIT_BIT   28
#define MP_28BIT
#define MP_DIGIT_BIT   DIGIT_BIT
#define MP_MASK   ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
#define MP_DIGIT_MAX   MP_MASK
#define MP_LT   -1
#define MP_EQ   0
#define MP_GT   1
#define MP_ZPOS   0
#define MP_NEG   1
#define MP_OKAY   0
#define MP_MEM   -2
#define MP_VAL   -3
#define MP_RANGE   MP_VAL
#define MP_YES   1
#define MP_NO   0
#define LTM_PRIME_BBS   0x0001
#define LTM_PRIME_SAFE   0x0002
#define LTM_PRIME_2MSB_ON   0x0008
#define MP_PREC   32
#define MP_WARRAY   (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
#define USED(m)   ((m)->used)
#define DIGIT(m, k)   ((m)->dp[(k)])
#define SIGN(m)   ((m)->sign)
#define mp_iszero(a)   (((a)->used == 0) ? MP_YES : MP_NO)
#define mp_iseven(a)   (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
#define mp_isodd(a)   (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
#define PRIME_SIZE   256
#define mp_prime_random(a, t, size, bbs, cb, dat)   mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)
#define mp_read_raw(mp, str, len)   mp_read_signed_bin((mp), (str), (len))
#define mp_raw_size(mp)   mp_signed_bin_size(mp)
#define mp_toraw(mp, str)   mp_to_signed_bin((mp), (str))
#define mp_read_mag(mp, str, len)   mp_read_unsigned_bin((mp), (str), (len))
#define mp_mag_size(mp)   mp_unsigned_bin_size(mp)
#define mp_tomag(mp, str)   mp_to_unsigned_bin((mp), (str))
#define mp_tobinary(M, S)   mp_toradix((M), (S), 2)
#define mp_tooctal(M, S)   mp_toradix((M), (S), 8)
#define mp_todecimal(M, S)   mp_toradix((M), (S), 10)
#define mp_tohex(M, S)   mp_toradix((M), (S), 16)
#define s_mp_mul(a, b, c)   s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)

Typedefs

typedef unsigned long long ulong64
typedef signed long long long64
typedef unsigned int mp_digit
typedef ulong64 mp_word
typedef int mp_err
typedef mp_int mp_int
typedef int ltm_prime_callback (unsigned char *dst, int len, void *dat)

Functions

unsigned long mp_get_int (mp_int *a)

Variables

MODULE_SCOPE int KARATSUBA_MUL_CUTOFF
MODULE_SCOPE int KARATSUBA_SQR_CUTOFF
MODULE_SCOPE int TOOM_MUL_CUTOFF
MODULE_SCOPE int TOOM_SQR_CUTOFF
MODULE_SCOPE const mp_digit ltm_prime_tab []
MODULE_SCOPE const char * mp_s_rmap


Define Documentation

#define DIGIT ( m,
 )     ((m)->dp[(k)])

Definition at line 214 of file tclTomMath.h.

#define LTM_PRIME_2MSB_ON   0x0008

Definition at line 172 of file tclTomMath.h.

#define LTM_PRIME_BBS   0x0001

Definition at line 170 of file tclTomMath.h.

#define LTM_PRIME_SAFE   0x0002

Definition at line 171 of file tclTomMath.h.

#define MAX ( x,
 )     ((x)>(y)?(x):(y))

Definition at line 36 of file tclTomMath.h.

#define MIN ( x,
 )     ((x)<(y)?(x):(y))

Definition at line 32 of file tclTomMath.h.

#define MODULE_SCOPE   extern

Definition at line 20 of file tclTomMath.h.

#define MP_28BIT

Definition at line 120 of file tclTomMath.h.

#define MP_DIGIT_BIT   DIGIT_BIT

Definition at line 149 of file tclTomMath.h.

Referenced by TclBNInitBignumFromLong(), and TclBNInitBignumFromWideUInt().

#define MP_DIGIT_MAX   MP_MASK

Definition at line 151 of file tclTomMath.h.

#define MP_EQ   0

Definition at line 155 of file tclTomMath.h.

Referenced by TclExecuteByteCode().

#define MP_GT   1

Definition at line 156 of file tclTomMath.h.

Referenced by TclExecuteByteCode().

#define mp_iseven (  )     (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)

Definition at line 265 of file tclTomMath.h.

Referenced by TclDoubleDigits().

#define mp_isodd (  )     (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)

Definition at line 266 of file tclTomMath.h.

#define mp_iszero (  )     (((a)->used == 0) ? MP_YES : MP_NO)

Definition at line 264 of file tclTomMath.h.

Referenced by TclCeil(), and TclExecuteByteCode().

#define MP_LT   -1

Definition at line 154 of file tclTomMath.h.

Referenced by Tcl_AppendFormatToObj(), TclCeil(), TclExecuteByteCode(), and TclFloor().

#define mp_mag_size ( mp   )     mp_unsigned_bin_size(mp)

Definition at line 765 of file tclTomMath.h.

#define MP_MASK   ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))

Definition at line 150 of file tclTomMath.h.

Referenced by TclBNInitBignumFromLong(), and TclBNInitBignumFromWideUInt().

#define MP_MEM   -2

Definition at line 162 of file tclTomMath.h.

#define MP_NEG   1

Definition at line 159 of file tclTomMath.h.

Referenced by TclBNInitBignumFromLong(), and TclSetBignumIntRep().

#define MP_NO   0

Definition at line 167 of file tclTomMath.h.

#define MP_PREC   32

Definition at line 190 of file tclTomMath.h.

#define mp_prime_random ( a,
t,
size,
bbs,
cb,
dat   )     mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)

Definition at line 690 of file tclTomMath.h.

#define MP_RANGE   MP_VAL

Definition at line 164 of file tclTomMath.h.

#define mp_raw_size ( mp   )     mp_signed_bin_size(mp)

Definition at line 762 of file tclTomMath.h.

#define mp_read_mag ( mp,
str,
len   )     mp_read_unsigned_bin((mp), (str), (len))

Definition at line 764 of file tclTomMath.h.

#define mp_read_raw ( mp,
str,
len   )     mp_read_signed_bin((mp), (str), (len))

Definition at line 761 of file tclTomMath.h.

#define mp_tobinary ( M,
 )     mp_toradix((M), (S), 2)

Definition at line 768 of file tclTomMath.h.

#define mp_todecimal ( M,
 )     mp_toradix((M), (S), 10)

Definition at line 770 of file tclTomMath.h.

#define mp_tohex ( M,
 )     mp_toradix((M), (S), 16)

Definition at line 771 of file tclTomMath.h.

#define mp_tomag ( mp,
str   )     mp_to_unsigned_bin((mp), (str))

Definition at line 766 of file tclTomMath.h.

#define mp_tooctal ( M,
 )     mp_toradix((M), (S), 8)

Definition at line 769 of file tclTomMath.h.

#define mp_toraw ( mp,
str   )     mp_to_signed_bin((mp), (str))

Definition at line 763 of file tclTomMath.h.

#define MP_VAL   -3

Definition at line 163 of file tclTomMath.h.

#define MP_WARRAY   (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))

Definition at line 197 of file tclTomMath.h.

#define MP_YES   1

Definition at line 166 of file tclTomMath.h.

#define MP_ZPOS   0

#define OPT_CAST (  ) 

Definition at line 48 of file tclTomMath.h.

#define PRIME_SIZE   256

Definition at line 627 of file tclTomMath.h.

#define s_mp_mul ( a,
b,
 )     s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)

Definition at line 780 of file tclTomMath.h.

#define SIGN (  )     ((m)->sign)

Definition at line 215 of file tclTomMath.h.

#define USED (  )     ((m)->used)

Definition at line 213 of file tclTomMath.h.


Typedef Documentation

typedef signed long long long64

Definition at line 104 of file tclTomMath.h.

typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat)

Definition at line 210 of file tclTomMath.h.

typedef unsigned int mp_digit

Definition at line 109 of file tclTomMath.h.

typedef int mp_err

Definition at line 174 of file tclTomMath.h.

typedef struct mp_int mp_int

Definition at line 202 of file tclTomMath.h.

typedef ulong64 mp_word

Definition at line 112 of file tclTomMath.h.

typedef unsigned long long ulong64

Definition at line 103 of file tclTomMath.h.


Function Documentation

unsigned long mp_get_int ( mp_int a  ) 


Variable Documentation

MODULE_SCOPE int KARATSUBA_MUL_CUTOFF

Definition at line 178 of file tclTomMath.h.

MODULE_SCOPE int KARATSUBA_SQR_CUTOFF

Definition at line 178 of file tclTomMath.h.

MODULE_SCOPE const mp_digit ltm_prime_tab[]

Definition at line 632 of file tclTomMath.h.

MODULE_SCOPE const char* mp_s_rmap

Definition at line 831 of file tclTomMath.h.

MODULE_SCOPE int TOOM_MUL_CUTOFF

Definition at line 178 of file tclTomMath.h.

MODULE_SCOPE int TOOM_SQR_CUTOFF

Definition at line 178 of file tclTomMath.h.



Generated on Wed Mar 12 12:18:34 2008 by  doxygen 1.5.1