From d09c63e68f38457623b95d38022ea2ab019dc701 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Wed, 14 Feb 2007 17:59:21 +0000 Subject: 2007-02-13 Kevin Kenny * tools/fix_tommath_h.tcl: Further tweaking for the x86-64. The change is to make 'mp_digit' be an 'unsigned int' on that platform; since we're using only 32 bits of it, there's no reason to make it a 64-bit 'unsigned long.' * generic/tclTomMath.h: Regenerated. --- ChangeLog | 10 +++++++++- generic/tclTomMath.h | 8 ++++---- tools/fix_tommath_h.tcl | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 979ca24..f26f443 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,17 @@ +2007-02-13 Kevin Kenny + + * tools/fix_tommath_h.tcl: Further tweaking for the x86-64. + The change is to make 'mp_digit' be an 'unsigned int' on that + platform; since we're using only 32 bits of it, there's no + reason to make it a 64-bit 'unsigned long.' + * generic/tclTomMath.h: Regenerated. + 2007-02-13 Donal K. Fellows * doc/re_syntax.n: Corrected description of 'print' class [Bug 1614687] and enhanced description of 'graph' class. -2007-02-09 Kevin Kenny +2007-02-12 Kevin Kenny * tools/fix_tommath_h.tcl: Added code to patch out a check for __x86_64__ that caused Tommath to use __attributes(TI)__ for the diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index aaa3fe7..d794316 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -51,7 +51,7 @@ extern "C" { /* detect 64-bit mode if possible */ -#if defined(NEVER) +#if defined(NEVER) /* 128-bit ints fail in too many places */ #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) #define MP_64BIT #endif @@ -106,7 +106,7 @@ extern "C" { #endif #ifndef MP_DIGIT_DECLARED - typedef unsigned long mp_digit; + typedef unsigned int mp_digit; #define MP_DIGIT_DECLARED #endif typedef ulong64 mp_word; @@ -840,6 +840,6 @@ MODULE_SCOPE const char *mp_s_rmap; /* $Source: /root/tcl/repos-to-convert/tcl/generic/tclTomMath.h,v $ */ /* Based on Tom's version 1.8 */ -/* $Revision: 1.9 $ */ -/* $Date: 2007/02/13 03:43:41 $ */ +/* $Revision: 1.10 $ */ +/* $Date: 2007/02/14 17:59:21 $ */ diff --git a/tools/fix_tommath_h.tcl b/tools/fix_tommath_h.tcl index 2ea3a02..9b2d258 100755 --- a/tools/fix_tommath_h.tcl +++ b/tools/fix_tommath_h.tcl @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: fix_tommath_h.tcl,v 1.5 2007/02/13 03:43:41 kennykb Exp $ +# RCS: @(#) $Id: fix_tommath_h.tcl,v 1.6 2007/02/14 17:59:22 kennykb Exp $ # #---------------------------------------------------------------------- @@ -18,6 +18,7 @@ close $f set eat_endif 0 set eat_semi 0 +set def_count 0 foreach line [split $data \n] { if { !$eat_semi && !$eat_endif } { switch -regexp -- $line { @@ -29,6 +30,18 @@ foreach line [split $data \n] { puts "\#define MODULE_SCOPE extern" puts "\#endif" } + {typedef\s+unsigned long\s+mp_digit;} { + # change the second 'typedef unsigned long mp + incr def_count + puts "\#ifndef MP_DIGIT_DECLARED" + if {$def_count == 2} { + puts [string map {long int} $line] + } else { + puts $line + } + puts "\#define MP_DIGIT_DECLARED" + puts "\#endif" + } {typedef.*mp_digit;} { puts "\#ifndef MP_DIGIT_DECLARED" puts $line -- cgit v0.12