Changeset 3f8dd01


Ignore:
Timestamp:
Sep 4, 2017, 10:09:45 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:
235b41f, f47ba55
Parents:
e612146c
Message:

add user literals to gmp

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/gmp

    re612146c r3f8dd01  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 24 09:24:51 2017
    13 // Update Count     : 16
     12// Last Modified On : Mon Sep  4 09:54:33 2017
     13// Update Count     : 20
    1414//
    1515
     
    3232static inline void ?{}( Int & this, const char * val ) { if ( mpz_init_set_str( this.mpz, val, 0 ) ) abort(); }
    3333static inline void ^?{}( Int & this ) { mpz_clear( this.mpz ); }
     34
     35// literal
     36static inline Int ?`mp( signed long int init ) { return (Int){ init }; }
     37static inline Int ?`mp( unsigned long int init ) { return (Int){ init }; }
     38static inline Int ?`mp( const char * init ) { return (Int){ init }; }
    3439
    3540// assignment
  • src/tests/.expect/64/gmp.txt

    re612146c r3f8dd01  
    55y:97
    66y:12345678901234567890123456789
     7y:200
     8y:-400
     9y:24691357802469135780246913578
    710y:3
    811y:-3
  • src/tests/gmp.c

    re612146c r3f8dd01  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 25 12:50:01 2017
    13 // Update Count     : 544
     12// Last Modified On : Mon Sep  4 09:51:18 2017
     13// Update Count     : 550
    1414//
    1515
     
    2929        sout | "y:" | y | endl;
    3030        y = "12345678901234567890123456789";
     31        sout | "y:" | y | endl;
     32        y = 100`mp + 100`mp;
     33        sout | "y:" | y | endl;
     34        y = -200u`mp + -200u`mp;
     35        sout | "y:" | y | endl;
     36        y = "12345678901234567890123456789"`mp + "12345678901234567890123456789"`mp;
    3137        sout | "y:" | y | endl;
    3238        y = si;
Note: See TracChangeset for help on using the changeset viewer.