summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-29 22:48:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-29 22:48:50 (GMT)
commit7a1b66b00db2dcc63f4743c36b4e8e6edcfc4211 (patch)
tree770e7df5a9383984bb53ff5db2ae72fea43a3f7d /generic/tclObj.c
parent4e994192a1fe60802c91b8ffee51720f54093bac (diff)
downloadtcl-7a1b66b00db2dcc63f4743c36b4e8e6edcfc4211.zip
tcl-7a1b66b00db2dcc63f4743c36b4e8e6edcfc4211.tar.gz
tcl-7a1b66b00db2dcc63f4743c36b4e8e6edcfc4211.tar.bz2
Update some libtommath functions to the latest trunk versions. Small step forward in the upgrade to (upcoming) libtommath 1.2.
Advantage: simplify Tcl code accessing those functions.
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 1738985..6bff71c 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -189,7 +189,7 @@ static Tcl_ThreadDataKey pendingObjDataKey;
mp_shrink(&(bignum)); \
} \
(objPtr)->internalRep.ptrAndLongRep.ptr = (void*) (bignum).dp; \
- (objPtr)->internalRep.ptrAndLongRep.value = ( ((bignum).sign << 30) \
+ (objPtr)->internalRep.ptrAndLongRep.value = ( (mp_isneg(&bignum) << 30) \
| ((bignum).alloc << 15) | ((bignum).used)); \
}
@@ -2787,7 +2787,7 @@ Tcl_GetLongFromObj(
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
- if (big.sign) {
+ if (mp_isneg(&big)) {
*longPtr = - (long) value;
} else {
*longPtr = (long) value;
@@ -3089,7 +3089,7 @@ Tcl_GetWideIntFromObj(
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
- if (big.sign) {
+ if (mp_isneg(&big)) {
*wideIntPtr = - (Tcl_WideInt) value;
} else {
*wideIntPtr = (Tcl_WideInt) value;
@@ -3508,10 +3508,10 @@ Tcl_SetBignumObj(
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
- if (value > (((~(unsigned long)0) >> 1) + bignumValue->sign)) {
+ if (value > (((~(unsigned long)0) >> 1) + mp_isneg(bignumValue))) {
goto tooLargeForLong;
}
- if (bignumValue->sign) {
+ if (mp_isneg(bignumValue)) {
TclSetLongObj(objPtr, -(long)value);
} else {
TclSetLongObj(objPtr, (long)value);
@@ -3533,10 +3533,10 @@ Tcl_SetBignumObj(
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
- if (value > (((~(Tcl_WideUInt)0) >> 1) + bignumValue->sign)) {
+ if (value > (((~(Tcl_WideUInt)0) >> 1) + mp_isneg(bignumValue))) {
goto tooLargeForWide;
}
- if (bignumValue->sign) {
+ if (mp_isneg(bignumValue)) {
TclSetWideIntObj(objPtr, -(Tcl_WideInt)value);
} else {
TclSetWideIntObj(objPtr, (Tcl_WideInt)value);