summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-09-27 18:42:53 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-09-27 18:42:53 (GMT)
commitf55cc93d98857e6b51fc83b642847257c75190c0 (patch)
treef841aa691a893fda3656ef67f72cfd9712e03000
parent373059201f1050bc3de9db10d9e442ef29da530b (diff)
downloadtcl-f55cc93d98857e6b51fc83b642847257c75190c0.zip
tcl-f55cc93d98857e6b51fc83b642847257c75190c0.tar.gz
tcl-f55cc93d98857e6b51fc83b642847257c75190c0.tar.bz2
[kennykb-numerics-branch]
* generic/tcl.h: Changed name of the new Tcl_Obj intrep field * generic/tclObj.c: from "bignumValue" to "ptrAndLongRep" as * generic/tclProc.c: described in TIP 237, and more suitable for other more general uses.
-rw-r--r--ChangeLog9
-rw-r--r--generic/tcl.h8
-rw-r--r--generic/tclObj.c38
-rw-r--r--generic/tclProc.c6
4 files changed, 34 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index ebedc2f..f6914ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-09-27 Don Porter <dgp@users.sourceforge.net>
+
+ [kennykb-numerics-branch]
+
+ * generic/tcl.h: Changed name of the new Tcl_Obj intrep field
+ * generic/tclObj.c: from "bignumValue" to "ptrAndLongRep" as
+ * generic/tclProc.c: described in TIP 237, and more suitable for
+ other more general uses.
+
2005-09-26 Kevin Kenny <kennykb@acm.org>
[kennykb-numerics-branch] Merge updates from HEAD.
diff --git a/generic/tcl.h b/generic/tcl.h
index dd42d9d..43efed4 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.191.2.10 2005/09/15 20:58:39 dgp Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.191.2.11 2005/09/27 18:42:54 dgp Exp $
*/
#ifndef _TCL
@@ -770,10 +770,10 @@ typedef struct Tcl_Obj {
} twoPtrValue;
struct { /* - internal rep as a wide int, tightly
* packed fields */
- VOID *digits; /* Pointer to digits */
- unsigned long misc; /* Alloc, used, and signum packed into a
+ VOID *ptr; /* Pointer to digits */
+ unsigned long value;/* Alloc, used, and signum packed into a
* single word */
- } bignumValue;
+ } ptrAndLongRep;
} internalRep;
} Tcl_Obj;
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 2367fb3..f573741 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclObj.c,v 1.72.2.38 2005/09/23 16:13:14 dgp Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.72.2.39 2005/09/27 18:42:54 dgp Exp $
*/
#include "tclInt.h"
@@ -148,28 +148,26 @@ static Tcl_ThreadDataKey pendingObjDataKey;
if ((bignum).used > 0x7fff) { \
mp_int *temp = (void *) ckalloc((unsigned) sizeof(mp_int)); \
*temp = bignum; \
- (objPtr)->internalRep.bignumValue.digits = (void*) temp; \
- (objPtr)->internalRep.bignumValue.misc = -1; \
+ (objPtr)->internalRep.ptrAndLongRep.ptr = (void*) temp; \
+ (objPtr)->internalRep.ptrAndLongRep.value = -1; \
} else { \
if ((bignum).alloc > 0x7fff) { \
mp_shrink(&(bignum)); \
} \
- (objPtr)->internalRep.bignumValue.digits = (void*) (bignum).dp; \
- (objPtr)->internalRep.bignumValue.misc = ( \
- ((bignum).sign << 30) \
- | ((bignum).alloc << 15) \
- | ((bignum).used)); \
+ (objPtr)->internalRep.ptrAndLongRep.ptr = (void*) (bignum).dp; \
+ (objPtr)->internalRep.ptrAndLongRep.value = ( ((bignum).sign << 30) \
+ | ((bignum).alloc << 15) | ((bignum).used)); \
}
#define UNPACK_BIGNUM(objPtr, bignum) \
- if ((objPtr)->internalRep.bignumValue.misc == -1) { \
- (bignum) = *((mp_int *) ((objPtr)->internalRep.bignumValue.digits)); \
+ if ((objPtr)->internalRep.ptrAndLongRep.value == -1) { \
+ (bignum) = *((mp_int *) ((objPtr)->internalRep.ptrAndLongRep.ptr)); \
} else { \
- (bignum).dp = (mp_digit*) (objPtr)->internalRep.bignumValue.digits; \
- (bignum).sign = (objPtr)->internalRep.bignumValue.misc >> 30; \
+ (bignum).dp = (mp_digit*) (objPtr)->internalRep.ptrAndLongRep.ptr; \
+ (bignum).sign = (objPtr)->internalRep.ptrAndLongRep.value >> 30; \
(bignum).alloc = \
- ((objPtr)->internalRep.bignumValue.misc >> 15) & 0x7fff; \
- (bignum).used = (objPtr)->internalRep.bignumValue.misc & 0x7fff; \
+ ((objPtr)->internalRep.ptrAndLongRep.value >> 15) & 0x7fff; \
+ (bignum).used = (objPtr)->internalRep.ptrAndLongRep.value & 0x7fff; \
}
/*
@@ -1310,7 +1308,7 @@ Tcl_GetBooleanFromObj(interp, objPtr, boolPtr)
#ifdef BIGNUM_AUTO_NARROW
*boolPtr = 1;
#else
- *boolPtr = ((objPtr->internalRep.bignumValue.misc & 0x7fff)!=0);
+ *boolPtr = ((objPtr->internalRep.ptrAndLongRep.value & 0x7fff)!=0);
#endif
return TCL_OK;
}
@@ -2527,8 +2525,8 @@ FreeBignum(Tcl_Obj *objPtr)
UNPACK_BIGNUM(objPtr, toFree);
mp_clear(&toFree);
- if (objPtr->internalRep.bignumValue.misc < 0) {
- ckfree((char *)objPtr->internalRep.bignumValue.digits);
+ if (objPtr->internalRep.ptrAndLongRep.value < 0) {
+ ckfree((char *)objPtr->internalRep.ptrAndLongRep.ptr);
}
}
@@ -2705,7 +2703,7 @@ Tcl_DbNewBignumObj(mp_int* bignumValue, CONST char* file, int line)
*
* Side effects:
* A copy of bignum is stored in *bignumValue, which is expected to be
- * uninitialized or cleared. If conversion fails, an the 'interp'
+ * uninitialized or cleared. If conversion fails, and the 'interp'
* argument is not NULL, an error message is stored in the interpreter
* result.
*
@@ -2730,8 +2728,8 @@ GetBignumFromObj(
Tcl_Panic("Tcl_GetBignumAndClearObj called on shared Tcl_Obj");
}
UNPACK_BIGNUM(objPtr, *bignumValue);
- objPtr->internalRep.bignumValue.digits = NULL;
- objPtr->internalRep.bignumValue.misc = 0;
+ objPtr->internalRep.ptrAndLongRep.ptr = NULL;
+ objPtr->internalRep.ptrAndLongRep.value = 0;
objPtr->typePtr = NULL;
if (objPtr->bytes == NULL) {
TclInitStringRep(objPtr, NULL, 0);
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 6b7a734..0a1611c 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclProc.c,v 1.66.2.7 2005/09/15 20:58:40 dgp Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.66.2.8 2005/09/27 18:42:54 dgp Exp $
*/
#include "tclInt.h"
@@ -688,7 +688,7 @@ TclObjGetFrame(interp, objPtr, framePtrPtr)
/*
* Cache for future reference.
*
- * TODO: Use the new bignumValue (long + pointer) intrep
+ * TODO: Use the new ptrAndLongRep intrep
*/
TclFreeIntRep(objPtr);
@@ -703,7 +703,7 @@ TclObjGetFrame(interp, objPtr, framePtrPtr)
/*
* Cache for future reference.
*
- * TODO: Use the new bignumValue (long + pointer) intrep
+ * TODO: Use the new ptrAndLongRep intrep
*/
TclFreeIntRep(objPtr);