Changeset 4f4ae60 for libcfa/prelude
- Timestamp:
- Dec 23, 2024, 2:41:11 PM (4 weeks ago)
- Branches:
- master
- Children:
- a6b48f6
- Parents:
- 43299af
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
r43299af r4f4ae60 27 27 // Defined destructor in the case that non-generated code wants to use __Destructor. 28 28 forall( T & ) 29 staticinline void ^?{}( __Destructor(T) & x ) {29 inline void ^?{}( __Destructor(T) & x ) { 30 30 if ( x.object && x.dtor ) { 31 31 x.dtor( x.object ); … … 52 52 53 53 forall( T & ) 54 staticinline T & identity( T & i ) {54 inline T & identity( T & i ) { 55 55 return i; 56 56 } … … 61 61 }; 62 62 63 staticinline void ?{}( generator$ & this ) { ((int&)this) = 0; }64 staticinline void ^?{}( generator$ & ) {}63 inline void ?{}( generator$ & this ) { ((int&)this) = 0; } 64 inline void ^?{}( generator$ & ) {} 65 65 66 66 forall( T & ) … … 71 71 72 72 forall( T & | is_generator( T ) ) 73 staticinline T & resume( T & gen ) {73 inline T & resume( T & gen ) { 74 74 main( gen ); 75 75 return gen; … … 93 93 // C11 reference manual Section 6.5.16 (page 101): "An assignment expression has the value of the left operand after the 94 94 // assignment, but is not an lvalue." Hence, return a value not a reference. 95 staticinline {95 inline { 96 96 forall( T& | is_value(T) | { T ?+=?( T &, one_t ); } ) 97 97 T ++?( T & x ) { return x += 1; } … … 116 116 #if defined(__SIZEOF_INT128__) 117 117 // constructor for 128-bit numbers (all constants are unsigned as +/- are operators) 118 staticinline void ?{}( unsigned int128 & this, unsigned long int h, unsigned long int l ) {118 inline void ?{}( unsigned int128 & this, unsigned long int h, unsigned long int l ) { 119 119 this = (unsigned int128)h << 64 | (unsigned int128)l; 120 120 } // ?{} … … 133 133 } // extern "C" 134 134 135 static inline { // wrappers 135 inline { 136 136 float ?\?( float x, float y ) { return powf( x, y ); } 137 137 double ?\?( double x, double y ) { return pow( x, y ); } … … 156 156 } // distribution 157 157 158 staticinline {158 inline { 159 159 int ?\=?( int & x, unsigned int y ) { x = x \ y; return x; } 160 160 long int ?\=?( long int & x, unsigned long int y ) { x = x \ y; return x; } … … 189 189 }; 190 190 191 static inline 192 forall( E | Serial( E ) ) { 191 inline forall( E | Serial( E ) ) { 193 192 E fromInt( int i ) { 194 193 E upper = upperBound(); … … 222 221 } 223 222 224 static inline 225 forall( E | CfaEnum( E ) ) { 223 inline forall( E | CfaEnum( E ) ) { 226 224 int ?==?( E l, E r ) { return posn( l ) == posn( r ); } 227 225 int ?!=?( E l, E r ) { return posn( l ) != posn( r ); } … … 232 230 } 233 231 234 static inline 235 forall( E | Serial( E ) ) { 232 inline forall( E | Serial( E ) ) { 236 233 E ?+=?( E & l, one_t ) { 237 234 int pos = fromInstance( l );
Note: See TracChangeset
for help on using the changeset viewer.