Changeset 7726839 for libcfa/prelude
- Timestamp:
- Mar 26, 2019, 10:29:25 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 697e484
- Parents:
- c274df2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
rc274df2 r7726839 10 10 // Created On : Fri Jul 21 16:21:03 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 26 14:05:49201913 // Update Count : 8412 // Last Modified On : Tue Mar 26 21:33:54 2019 13 // Update Count : 92 14 14 // 15 15 … … 18 18 typedef unsigned long long __cfaabi_abi_exception_type_t; 19 19 20 #include <limits.h> // CHAR_BIT 20 21 #include "../src/virtual.h" 21 22 #include "../src/exception.h" … … 61 62 static inline long double _Complex ?\?( long double _Complex x, _Complex long double y ) { return cpowl( x, y ); } 62 63 64 #define __CFA_BASE_COMP_1__() if ( ep == 1 ) return 1 65 #define __CFA_BASE_COMP_2__() if ( ep == 2 ) return ep << (y - 1) 66 #define __CFA_EXP_OVERFLOW__() if ( y >= sizeof(y) * CHAR_BIT ) return 0 67 63 68 #define __CFA_EXP__() \ 64 69 if ( y == 0 ) return 1; /* base case */ \ 65 __CFA_BASE_COMP_1__() /* base case */ \66 __CFA_BASE_COMP_2__() /* special case, positive shifting for integral types */ \67 __CFA_EXP_OVERFLOW__() /* immediate overflow, negative exponent > 2^size-1 */ \70 __CFA_BASE_COMP_1__(); /* base case */ \ 71 __CFA_BASE_COMP_2__(); /* special case, positive shifting for integral types */ \ 72 __CFA_EXP_OVERFLOW__(); /* immediate overflow, negative exponent > 2^size-1 */ \ 68 73 typeof(ep) op = 1; /* accumulate odd product */ \ 69 74 for ( ; y > 1; y >>= 1 ) { /* squaring exponentiation, O(log2 y) */ \ … … 72 77 } \ 73 78 return ep * op 74 75 #define __CFA_BASE_COMP_1__() if ( ep == 1 ) return 1;76 #define __CFA_BASE_COMP_2__() if ( ep == 2 ) return ep << (y - 1);77 #define __CFA_EXP_OVERFLOW__() if ( y >= sizeof(y) * 8 ) return 0;78 79 79 80 static inline long int ?\?( int ep, unsigned int y ) { … … 106 107 } // ?\? 107 108 108 static inline forall( otype OT | { void ?{}( OT & this, zero_t ); void ?{}( OT & this, one_t ); int ?==?( OT, OT); OT ?*?( OT, OT ); } )109 static inline forall( otype OT | { void ?{}( OT & this, one_t ); OT ?*?( OT, OT ); } ) 109 110 OT ?\?( OT ep, unsigned long int y ) { 110 111 __CFA_EXP__();
Note: See TracChangeset
for help on using the changeset viewer.