Changeset 5a7789f
- Timestamp:
- Jul 19, 2023, 9:50:28 PM (17 months ago)
- Branches:
- master
- Children:
- 5e6fb07, d3b8752
- Parents:
- 21a700e (diff), 8a1d62b6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- libcfa
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
r21a700e r5a7789f 132 132 } // distribution 133 133 134 #define __CFA_BASE_COMP_1__() if ( x == 1 ) return 1135 #define __CFA_BASE_COMP_2__() if ( x == 2 ) return x << (y - 1)136 #define __CFA_EXP_OVERFLOW__() if ( y >= sizeof(y) * CHAR_BIT ) return 0137 138 134 #define __CFA_EXP__() \ 139 135 if ( y == 0 ) return 1; /* convention */ \ 140 __CFA_BASE_COMP_1__(); /* base case */ \ 141 __CFA_BASE_COMP_2__(); /* special case, positive shifting for integral types */ \ 142 __CFA_EXP_OVERFLOW__(); /* immediate overflow, negative exponent > 2^size-1 */ \ 136 __CFA_EXP_INT__( /* special cases for integral types */ \ 137 if ( x == 1 ) return 1; /* base case */ \ 138 if ( x == 2 ) return x << (y - 1); /* positive shifting */ \ 139 if ( y >= sizeof(y) * CHAR_BIT ) return 0; /* immediate overflow, negative exponent > 2^size-1 */ \ 140 ) \ 143 141 typeof(x) op = 1; /* accumulate odd product */ \ 144 142 for ( ; y > 1; y >>= 1 ) { /* squaring exponentiation, O(log2 y) */ \ … … 147 145 } \ 148 146 return x * op 147 #define __CFA_EXP_INT__(...) __VA_ARGS__ 149 148 150 149 static inline { … … 158 157 } // distribution 159 158 160 #undef __CFA_BASE_COMP_1__ 161 #undef __CFA_BASE_COMP_2__ 162 #undef __CFA_EXP_OVERFLOW__ 163 #define __CFA_BASE_COMP_1__() 164 #define __CFA_BASE_COMP_2__() 165 #define __CFA_EXP_OVERFLOW__() 159 #undef __CFA_EXP_INT__ 160 #define __CFA_EXP_INT__(...) 166 161 167 162 static inline forall( OT | { void ?{}( OT & this, one_t ); OT ?*?( OT, OT ); } ) { … … 171 166 } // distribution 172 167 173 #undef __CFA_BASE_COMP_1__ 174 #undef __CFA_BASE_COMP_2__ 175 #undef __CFA_EXP_OVERFLOW__ 168 #undef __CFA_EXP_INT__ 169 #undef __CFA_EXP__ 176 170 177 171 static inline { -
libcfa/src/gmp.hfa
r21a700e r5a7789f 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jun 29 09:43:30202313 // Update Count : 3 312 // Last Modified On : Tue Jul 18 11:04:54 2023 13 // Update Count : 35 14 14 // 15 15 … … 268 268 return os; 269 269 } // ?|? 270 271 void ?|?( ostype & os, Int mp ) { 272 (ostype)(os | mp); ends( os ); 273 } // ?|? 270 OSTYPE_VOID_IMPL( Int ) 274 271 } // distribution 275 272 } // distribution -
libcfa/src/iostream.cfa
r21a700e r5a7789f 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 18 1 0:42:51 202313 // Update Count : 140 112 // Last Modified On : Tue Jul 18 13:56:01 2023 13 // Update Count : 1403 14 14 // 15 15 … … 760 760 761 761 762 #define ISTYPE_VOID_VAL_IMPL( T ) \763 void ?|?( istype & is, T t ) { \764 (istype &)(is | t); ends( is ); \765 } // ?|?766 767 762 forall( istype & | basic_istream( istype ) ) { 768 763 istype & ?|?( istype & is, bool & b ) { … … 777 772 return is; 778 773 } // ?|? 779 ISTYPE_VOID_IMPL( bool )774 ISTYPE_VOID_IMPL( bool & ) 780 775 781 776 istype & ?|?( istype & is, char & c ) { … … 789 784 return is; 790 785 } // ?|? 791 ISTYPE_VOID_IMPL( char )786 ISTYPE_VOID_IMPL( char & ) 792 787 793 788 istype & ?|?( istype & is, signed char & sc ) { … … 795 790 return is; 796 791 } // ?|? 797 ISTYPE_VOID_IMPL( signed char )792 ISTYPE_VOID_IMPL( signed char & ) 798 793 799 794 istype & ?|?( istype & is, unsigned char & usc ) { … … 801 796 return is; 802 797 } // ?|? 803 ISTYPE_VOID_IMPL( unsigned char )798 ISTYPE_VOID_IMPL( unsigned char & ) 804 799 805 800 istype & ?|?( istype & is, short int & si ) { … … 807 802 return is; 808 803 } // ?|? 809 ISTYPE_VOID_IMPL( short int )804 ISTYPE_VOID_IMPL( short int & ) 810 805 811 806 istype & ?|?( istype & is, unsigned short int & usi ) { … … 813 808 return is; 814 809 } // ?|? 815 ISTYPE_VOID_IMPL( unsigned short int )810 ISTYPE_VOID_IMPL( unsigned short int & ) 816 811 817 812 istype & ?|?( istype & is, int & i ) { … … 819 814 return is; 820 815 } // ?|? 821 ISTYPE_VOID_IMPL( int )816 ISTYPE_VOID_IMPL( int & ) 822 817 823 818 istype & ?|?( istype & is, unsigned int & ui ) { … … 825 820 return is; 826 821 } // ?|? 827 ISTYPE_VOID_IMPL( unsigned int )822 ISTYPE_VOID_IMPL( unsigned int & ) 828 823 829 824 istype & ?|?( istype & is, long int & li ) { … … 831 826 return is; 832 827 } // ?|? 833 ISTYPE_VOID_IMPL( long int )828 ISTYPE_VOID_IMPL( long int & ) 834 829 835 830 istype & ?|?( istype & is, unsigned long int & ulli ) { … … 837 832 return is; 838 833 } // ?|? 839 ISTYPE_VOID_IMPL( unsigned long int )834 ISTYPE_VOID_IMPL( unsigned long int & ) 840 835 841 836 istype & ?|?( istype & is, long long int & lli ) { … … 843 838 return is; 844 839 } // ?|? 845 ISTYPE_VOID_IMPL( long long int )840 ISTYPE_VOID_IMPL( long long int & ) 846 841 847 842 istype & ?|?( istype & is, unsigned long long int & ulli ) { … … 849 844 return is; 850 845 } // ?|? 851 ISTYPE_VOID_IMPL( unsigned long long int )846 ISTYPE_VOID_IMPL( unsigned long long int & ) 852 847 853 848 #if defined( __SIZEOF_INT128__ ) … … 855 850 return (istype &)(is | (unsigned int128 &)llli); 856 851 } // ?|? 857 ISTYPE_VOID_IMPL( int128 )852 ISTYPE_VOID_IMPL( int128 & ) 858 853 859 854 istype & ?|?( istype & is, unsigned int128 & ullli ) { … … 872 867 return is; 873 868 } // ?|? 874 ISTYPE_VOID_IMPL( unsigned int128 )869 ISTYPE_VOID_IMPL( unsigned int128 & ) 875 870 #endif // __SIZEOF_INT128__ 876 871 … … 879 874 return is; 880 875 } // ?|? 881 ISTYPE_VOID_IMPL( float )876 ISTYPE_VOID_IMPL( float & ) 882 877 883 878 istype & ?|?( istype & is, double & d ) { … … 885 880 return is; 886 881 } // ?|? 887 ISTYPE_VOID_IMPL( double )882 ISTYPE_VOID_IMPL( double & ) 888 883 889 884 istype & ?|?( istype & is, long double & ld ) { … … 891 886 return is; 892 887 } // ?|? 893 ISTYPE_VOID_IMPL( long double )888 ISTYPE_VOID_IMPL( long double & ) 894 889 895 890 istype & ?|?( istype & is, float _Complex & fc ) { … … 899 894 return is; 900 895 } // ?|? 901 ISTYPE_VOID_IMPL( float _Complex )896 ISTYPE_VOID_IMPL( float _Complex & ) 902 897 903 898 istype & ?|?( istype & is, double _Complex & dc ) { … … 907 902 return is; 908 903 } // ?|? 909 ISTYPE_VOID_IMPL( double _Complex )904 ISTYPE_VOID_IMPL( double _Complex & ) 910 905 911 906 istype & ?|?( istype & is, long double _Complex & ldc ) { … … 915 910 return is; 916 911 } // ?|? 917 ISTYPE_VOID_IMPL( long double _Complex )912 ISTYPE_VOID_IMPL( long double _Complex & ) 918 913 919 914 // istype & ?|?( istype & is, const char fmt[] ) { … … 926 921 return is; 927 922 } // ?|? 928 ISTYPE_VOID_ VAL_IMPL( char * )923 ISTYPE_VOID_IMPL( char * ) 929 924 930 925 // manipulators … … 988 983 return is; 989 984 } // ?|? 990 ISTYPE_VOID_ VAL_IMPL( _Istream_Cstr )985 ISTYPE_VOID_IMPL( _Istream_Cstr ) 991 986 992 987 istype & ?|?( istype & is, _Istream_Char f ) { … … 994 989 return is; 995 990 } // ?|? 996 ISTYPE_VOID_ VAL_IMPL( _Istream_Char )991 ISTYPE_VOID_IMPL( _Istream_Char ) 997 992 } // distribution 998 993 … … 1011 1006 return is; \ 1012 1007 } /* ?|? */ \ 1013 ISTYPE_VOID_ VAL_IMPL( _Istream_Manip(T) ) \1008 ISTYPE_VOID_IMPL( _Istream_Manip(T) ) \ 1014 1009 } // distribution 1015 1010 … … 1039 1034 return is; 1040 1035 } // ?|? 1041 ISTYPE_VOID_ VAL_IMPL( _Istream_Manip(float _Complex) )1036 ISTYPE_VOID_IMPL( _Istream_Manip(float _Complex) ) 1042 1037 1043 1038 istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) { … … 1050 1045 return is; 1051 1046 } // ?|? 1052 ISTYPE_VOID_ VAL_IMPL( _Istream_Manip(double _Complex) )1047 ISTYPE_VOID_IMPL( _Istream_Manip(double _Complex) ) 1053 1048 1054 1049 istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) { … … 1061 1056 return is; 1062 1057 } // ?|? 1063 ISTYPE_VOID_ VAL_IMPL( _Istream_Manip(long double _Complex) )1058 ISTYPE_VOID_IMPL( _Istream_Manip(long double _Complex) ) 1064 1059 } // distribution 1065 1060 -
libcfa/src/iostream.hfa
r21a700e r5a7789f 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 18 1 0:42:52202313 // Update Count : 4 3812 // Last Modified On : Tue Jul 18 15:57:21 2023 13 // Update Count : 462 14 14 // 15 15 … … 138 138 OSTYPE_VOID( const void * ); 139 139 140 // forall( T | { ostype & ?|?( ostype &, T ); } ) 141 // void ?|?( ostype & os, T ); 142 140 143 // manipulators 141 144 ostype & ?|?( ostype &, ostype & (*)( ostype & ) ); … … 214 217 forall( ostype & | basic_ostream( ostype ) ) { \ 215 218 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \ 216 void ?|?( ostype & os, _Ostream_Manip(T) f); \219 OSTYPE_VOID( _Ostream_Manip(T) ); \ 217 220 } // ?|? 218 221 … … 259 262 forall( ostype & | basic_ostream( ostype ) ) { \ 260 263 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \ 261 void ?|?( ostype & os, _Ostream_Manip(T) f); \264 OSTYPE_VOID( _Ostream_Manip(T) ); \ 262 265 } // ?|? 263 266 … … 279 282 forall( ostype & | basic_ostream( ostype ) ) { 280 283 ostype & ?|?( ostype & os, _Ostream_Manip(char) f ); 281 void ?|?( ostype & os, _Ostream_Manip(char) f );284 OSTYPE_VOID( _Ostream_Manip(char) ); \ 282 285 } // ?|? 283 286 … … 297 300 forall( ostype & | basic_ostream( ostype ) ) { 298 301 ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f ); 299 void ?|?( ostype & os, _Ostream_Manip(const char *) f );302 OSTYPE_VOID( _Ostream_Manip(const char *) ); \ 300 303 } // ?|? 301 304 … … 306 309 #define ISTYPE_VOID( T ) void ?|?( istype &, T ) 307 310 #define ISTYPE_VOID_IMPL( T ) \ 308 void ?|?( istype & is, T &t ) { \311 void ?|?( istype & is, T t ) { \ 309 312 (istype &)(is | t); ends( is ); \ 310 313 } // ?|? … … 387 390 // istype & ?|?( istype &, const char [] ); 388 391 istype & ?|?( istype &, char [] ); 389 void ?|?( istype &, char []);392 ISTYPE_VOID( char * ); 390 393 391 394 // manipulators … … 426 429 forall( istype & | basic_istream( istype ) ) { 427 430 istype & ?|?( istype & is, _Istream_Cstr f ); 428 void ?|?( istype & is, _Istream_Cstr f);431 ISTYPE_VOID( _Istream_Cstr ); 429 432 } 430 433 … … 439 442 forall( istype & | basic_istream( istype ) ) { 440 443 istype & ?|?( istype & is, _Istream_Char f ); 441 void ?|?( istype & is, _Istream_Char f);444 ISTYPE_VOID( _Istream_Char ); 442 445 } 443 446 … … 458 461 forall( istype & | basic_istream( istype ) ) { \ 459 462 istype & ?|?( istype & is, _Istream_Manip(T) f ); \ 460 void ?|?( istype & is, _Istream_Manip(T) f); \463 ISTYPE_VOID( _Istream_Manip(T) ); \ 461 464 } // ?|? 462 465 … … 488 491 forall( ostype & | ostream( ostype ) ) { 489 492 ostype & ?|?( ostype & os, Duration dur ); 490 void ?|?( ostype & os, Duration dur);493 OSTYPE_VOID( Duration ); 491 494 ostype & ?|?( ostype & os, Time time ); 492 void ?|?( ostype & os, Time time );495 OSTYPE_VOID( Time ); 493 496 } // distribution 494 497
Note: See TracChangeset
for help on using the changeset viewer.