Version 3 of Fixing C Access to Bignums

Updated 2009-09-30 15:59:39 by dgp

The following routines in Tcl's public interface, tcl.h, make use of the mp_int type:

  • Tcl_NewBignumObj(mp_int *)
  • Tcl_DbNewBignumObj(mp_int *, const char *, int)
  • Tcl_SetBignumObj(Tcl_Obj *, mp_int *)
  • Tcl_GetBignumFromObj(Tcl_Interp *, Tcl_Obj *, mp_int *)
  • Tcl_TakeBignumFromObj(Tcl_Interp *, Tcl_Obj *, mp_int *)
  • Tcl_InitBignumFromDouble(Tcl_Interp *, double, mp_int *)

Tcl's public header, tcl.h also includes these declarations:

#ifndef MP_INT_DECLARED
typedef struct mp_int mp_int;
#define MP_INT_DECLARED
#endif
#ifndef MP_DIGIT_DECLARED
typedef unsigned long mp_digit;
#define MP_DIGIT_DECLARED
#endif