=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2018/io/cpexpr.c,v retrieving revision 1.4 retrieving revision 1.7 diff -u -p -r1.4 -r1.7 --- OpenXM_contrib2/asir2018/io/cpexpr.c 2020/02/22 06:23:36 1.4 +++ OpenXM_contrib2/asir2018/io/cpexpr.c 2022/04/03 00:49:25 1.7 @@ -44,7 +44,7 @@ * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. - * $OpenXM: OpenXM_contrib2/asir2018/io/cpexpr.c,v 1.3 2019/03/06 07:35:40 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2018/io/cpexpr.c,v 1.6 2021/03/25 22:09:25 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -252,10 +252,12 @@ void PRINTV(VL vl,V v) void PRINTMPZ(mpz_t n) { - if ( hex_output ) - total_length += mpz_sizeinbase(n,16)+2; + if ( hex_output == 1 ) + total_length += mpz_sizeinbase(n,16)+3; + else if ( hex_output == 2 ) + total_length += mpz_sizeinbase(n,2)+3; else - total_length += mpz_sizeinbase(n,10); + total_length += mpz_sizeinbase(n,10)+1; } void PRINTZ(Z n) @@ -403,7 +405,7 @@ void PRINTUP2(UP2 p) total_length += 11; } for ( i = d-1; i >= 0; i-- ) { - if ( p->b[i/BSH] & (1<<(i%BSH)) ) + if ( p->b[i/BSH] & (1<<(i%BSH)) ) { if ( !i ) { PUTS("+1"); } else if ( i == 1 ) { @@ -412,6 +414,7 @@ void PRINTUP2(UP2 p) PRINTHAT; total_length += 12; } + } } PUTS(")"); }