Changeset 8a30423


Ignore:
Timestamp:
Mar 27, 2019, 8:55:18 AM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
0087e0e
Parents:
697e484
Message:

more exponential clean up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r697e484 r8a30423  
    1010// Created On       : Fri Jul 21 16:21:03 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 26 21:33:54 2019
    13 // Update Count     : 92
     12// Last Modified On : Tue Mar 26 23:10:36 2019
     13// Update Count     : 95
    1414//
    1515
     
    2727// increment/decrement unification
    2828
    29 static inline forall( dtype DT | { DT & ?+=?( DT &, one_t ); } )
    30 DT & ++?( DT & x ) { return x += 1; }
     29static inline {
     30        forall( dtype DT | { DT & ?+=?( DT &, one_t ); } )
     31        DT & ++?( DT & x ) { return x += 1; }
    3132
    32 static inline forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?+=?( DT &, one_t ); } )
    33 DT & ?++( DT & x ) { DT tmp = x; x += 1; return tmp; }
     33        forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?+=?( DT &, one_t ); } )
     34        DT & ?++( DT & x ) { DT tmp = x; x += 1; return tmp; }
    3435
    35 static inline forall( dtype DT | { DT & ?-=?( DT &, one_t ); } )
    36 DT & --?( DT & x ) { return x -= 1; }
     36        forall( dtype DT | { DT & ?-=?( DT &, one_t ); } )
     37        DT & --?( DT & x ) { return x -= 1; }
    3738
    38 static inline forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?-=?( DT &, one_t ); } )
    39 DT & ?--( DT & x ) { DT tmp = x; x -= 1; return tmp; }
     39        forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?-=?( DT &, one_t ); } )
     40        DT & ?--( DT & x ) { DT tmp = x; x -= 1; return tmp; }
     41} // distribution
    4042
    4143// universal typed pointer constant
    42 
    43 // Compiler issue: there is a problem with anonymous types that do not have  a size.
     44// Compiler issue: there is a problem with anonymous types that do not have a size.
    4445static inline forall( dtype DT | sized(DT) ) DT * intptr( uintptr_t addr ) { return (DT *)addr; }
    4546
     
    5556} // extern "C"
    5657
    57 static inline float ?\?( float x, float y ) { return powf( x, y ); }
    58 static inline double ?\?( double x, double y ) { return pow( x, y ); }
    59 static inline long double ?\?( long double x, long double y ) { return powl( x, y ); }
    60 static inline float _Complex ?\?( float _Complex x, _Complex float y ) { return cpowf(x, y ); }
    61 static inline double _Complex ?\?( double _Complex x, _Complex double y ) { return cpow( x, y ); }
    62 static inline long double _Complex ?\?( long double _Complex x, _Complex long double y ) { return cpowl( x, y ); }
     58static inline {
     59        float ?\?( float x, float y ) { return powf( x, y ); }
     60        double ?\?( double x, double y ) { return pow( x, y ); }
     61        long double ?\?( long double x, long double y ) { return powl( x, y ); }
     62        float _Complex ?\?( float _Complex x, _Complex float y ) { return cpowf(x, y ); }
     63        double _Complex ?\?( double _Complex x, _Complex double y ) { return cpow( x, y ); }
     64        long double _Complex ?\?( long double _Complex x, _Complex long double y ) { return cpowl( x, y ); }
     65} // distribution
    6366
    6467#define __CFA_BASE_COMP_1__() if ( ep == 1 ) return 1
     
    6770
    6871#define __CFA_EXP__() \
    69         if ( y == 0 ) return 1;                                                         /* base case */ \
     72        if ( y == 0 ) return 1;                                                         /* convention */ \
    7073        __CFA_BASE_COMP_1__();                                                          /* base case */ \
    7174        __CFA_BASE_COMP_2__();                                                          /* special case, positive shifting for integral types */ \
     
    7881        return ep * op
    7982
    80 static inline long int ?\?( int ep, unsigned int y ) {
    81         __CFA_EXP__();
    82 } // ?\?
    83 
    84 static inline long int ?\?( long int ep, unsigned long int y ) {
    85         __CFA_EXP__();
    86 } // ?\?
    87 
    88 // unsigned computation may be faster and larger
    89 static inline unsigned long int ?\?( unsigned int ep, unsigned int y ) {
    90         __CFA_EXP__();
    91 } // ?\?
    92 
    93 static inline unsigned long int ?\?( unsigned long int ep, unsigned long int y ) {
    94         __CFA_EXP__();
    95 } // ?\?
     83static inline {
     84        long int ?\?( int ep, unsigned int y ) { __CFA_EXP__(); }
     85        long int ?\?( long int ep, unsigned long int y ) { __CFA_EXP__(); }
     86        // unsigned computation may be faster and larger
     87        unsigned long int ?\?( unsigned int ep, unsigned int y ) { __CFA_EXP__(); }
     88        unsigned long int ?\?( unsigned long int ep, unsigned long int y ) { __CFA_EXP__(); }
     89} // distribution
    9690
    9791#undef __CFA_BASE_COMP_1__
     
    10296#define __CFA_EXP_OVERFLOW__()
    10397
    104 static inline forall( otype OT | { void ?{}( OT & this, one_t ); OT ?*?( OT, OT ); } )
    105 OT ?\?( OT ep, unsigned int y ) {
    106         __CFA_EXP__();
    107 } // ?\?
    108 
    109 static inline forall( otype OT | { void ?{}( OT & this, one_t ); OT ?*?( OT, OT ); } )
    110 OT ?\?( OT ep, unsigned long int y ) {
    111         __CFA_EXP__();
    112 } // ?\?
     98static inline forall( otype OT | { void ?{}( OT & this, one_t ); OT ?*?( OT, OT ); } ) {
     99        OT ?\?( OT ep, unsigned int y ) { __CFA_EXP__(); }
     100        OT ?\?( OT ep, unsigned long int y ) { __CFA_EXP__(); }
     101} // distribution
    113102
    114103#undef __CFA_BASE_COMP_1__
     
    116105#undef __CFA_EXP_OVERFLOW__
    117106
    118 static inline long int ?\=?( long int & x, unsigned long int y ) { x = x \ y; return x; }
    119 static inline unsigned long int ?\=?( unsigned long int & x, unsigned long int y ) { x = x \ y; return x; }
    120 static inline int ?\=?( int & x, unsigned long int y ) { x = x \ y; return x; }
    121 static inline unsigned int ?\=?( unsigned int & x, unsigned long int y ) { x = x \ y; return x; }
     107static inline {
     108        long int ?\=?( long int & x, unsigned long int y ) { x = x \ y; return x; }
     109        unsigned long int ?\=?( unsigned long int & x, unsigned long int y ) { x = x \ y; return x; }
     110        int ?\=?( int & x, unsigned long int y ) { x = x \ y; return x; }
     111        unsigned int ?\=?( unsigned int & x, unsigned long int y ) { x = x \ y; return x; }
     112} // distribution
    122113
    123114// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.