Changes in libcfa/prelude/builtins.c [c960331:0a25c34]
- File:
-
- 1 edited
-
libcfa/prelude/builtins.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
rc960331 r0a25c34 9 9 // Author : Peter A. Buhr 10 10 // Created On : Fri Jul 21 16:21:03 2017 11 // Last Modified By : Andrew Beach12 // Last Modified On : T ue Oct 27 14:42:00 202013 // Update Count : 1 1111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 21 16:31:39 2019 13 // Update Count : 101 14 14 // 15 16 #define __cforall_builtins__17 15 18 16 // type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions … … 51 49 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 52 50 53 forall(dtype T)54 static inline T & identity(T & i) {55 return i;56 }57 58 // generator support59 struct $generator {60 inline int;61 };62 63 static inline void ?{}($generator & this) { ((int&)this) = 0; }64 static inline void ^?{}($generator &) {}65 66 trait is_generator(dtype T) {67 void main(T & this);68 $generator * get_generator(T & this);69 };70 71 forall(dtype T | is_generator(T))72 static inline T & resume(T & gen) {73 main(gen);74 return gen;75 }76 77 51 // implicit increment, decrement if += defined, and implicit not if != defined 78 52 … … 96 70 // universal typed pointer constant 97 71 static inline forall( dtype DT ) DT * intptr( uintptr_t addr ) { return (DT *)addr; } 98 static inline forall( ftype FT ) FT * intptr( uintptr_t addr ) { return (FT *)addr; }99 100 #if defined(__SIZEOF_INT128__)101 // constructor for 128-bit numbers (all constants are unsigned as +/- are operators)102 static inline void ?{}( unsigned int128 & this, unsigned long int h, unsigned long int l ) {103 this = (unsigned int128)h << 64 | (unsigned int128)l;104 } // ?{}105 #endif // __SIZEOF_INT128__106 72 107 73 // exponentiation operator implementation
Note:
See TracChangeset
for help on using the changeset viewer.