Changeset 4adbe45


Ignore:
Timestamp:
May 22, 2017, 8:45:05 AM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
18c55e1
Parents:
0ed8759
Message:

fix bug in converting string to number and update test

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/gmp

    r0ed8759 r4adbe45  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 14 23:47:36 2017
    13 // Update Count     : 9
     12// Last Modified On : Mon May 22 08:32:39 2017
     13// Update Count     : 13
    1414//
    1515
     
    3535Int ?=?( Int * lhs, long int rhs ) { mpz_set_si( lhs->mpz, rhs ); return *lhs; }
    3636Int ?=?( Int * lhs, unsigned long int rhs ) { mpz_set_ui( lhs->mpz, rhs ); return *lhs; }
    37 //Int ?=?( Int * lhs, const char * rhs ) { if ( mpq_set_str( lhs->mpz, rhs, 0 ) ) abort(); return *lhs; }
     37Int ?=?( Int * lhs, const char * rhs ) { if ( mpz_set_str( lhs->mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return *lhs; }
    3838
    3939char ?=?( char * lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }
  • src/tests/.expect/64/gmp.txt

    r0ed8759 r4adbe45  
    44conversions
    55y:97
     6y:12345678901234567890123456789
    67y:3
    78y:-3
     
    2425z:150000000000000000000
    2526z:16666666666666666666
     2716666666666666666666, 2 16666666666666666666, 2
    2628x:16666666666666666666 y:2
    2729
  • src/tests/gmp.c

    r0ed8759 r4adbe45  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 14 14:46:50 2017
    13 // Update Count     : 530
     12// Last Modified On : Mon May 22 08:37:26 2017
     13// Update Count     : 533
    1414//
    1515
     
    2525        sout | "conversions" | endl;
    2626        y = 'a';
     27        sout | "y:" | y | endl;
     28        y = "12345678901234567890123456789";
    2729        sout | "y:" | y | endl;
    2830        y = si;
     
    6264        z = x / 3;
    6365        sout | "z:" | z | endl;
     66        sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
    6467        [ x, y ] = div( x, 3 );
    6568        sout | "x:" | x | "y:" | y | endl;
    66 //      sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
    6769
    6870        sout | endl;
Note: See TracChangeset for help on using the changeset viewer.