Changeset 5780d0d


Ignore:
Timestamp:
Dec 18, 2024, 10:33:40 AM (2 hours ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Parents:
94aa202
Message:

Removed increment and decrement operators for enumerations from builtins. I am confident the generic fallbacks work because I added tests.

Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r94aa202 r5780d0d  
    6666forall( T & )
    6767trait is_generator {
    68       void main( T & this );
    69       generator$ * get_generator( T & this );
     68        void main( T & this );
     69        generator$ * get_generator( T & this );
    7070};
    7171
     
    234234static inline
    235235forall( E | Serial( E ) ) {
    236         E ++?( E & l ) {
     236        E ?+=?( E & l, one_t ) {
    237237                int pos = fromInstance( l );
    238238                l = fromInt_unsafe( pos + 1 );
     
    240240        }
    241241
    242         E --?( E & l ) {
     242        E ?-=?( E & l, one_t ) {
    243243                int pos = fromInstance( l );
    244244                l = fromInt_unsafe( pos - 1 );
     
    246246        }
    247247
    248         E ?+=?( E & l, one_t ) {
    249                 int pos = fromInstance( l );
    250                 l = fromInt_unsafe( pos + 1 );
    251                 return l;
    252         }
    253 
    254         E ?-=?( E & l, one_t ) {
    255                 int pos = fromInstance( l );
    256                 l = fromInt_unsafe( pos - 1 );
    257                 return l;
    258         }
    259 
    260248        E ?+=?( E & l, int i ) {
    261249                int pos = fromInstance( l );
     
    268256                l = fromInt_unsafe( pos - i );
    269257                return l;
    270         }
    271 
    272         E ?++( E & l ) {
    273                 int pos = fromInstance( l );
    274                 l = fromInt_unsafe( pos + 1 );
    275                 return fromInt_unsafe( pos );
    276         }
    277 
    278         E ?--( E & l ) {
    279                 int pos = fromInstance( l );
    280                 l = fromInt_unsafe( pos - 1 );
    281                 return fromInt_unsafe( pos );
    282258        }
    283259}
  • tests/.expect/KRfunctions.arm64.txt

    r94aa202 r5780d0d  
    9999    signed int _X1bi_2;
    100100    {
    101         signed int *(*_tmp_cp_ret8)(signed int __param_0, signed int __param_1);
    102         ((void)(_X1xFPi_ii__2=(((void)(_tmp_cp_ret8=_X3f10FFPi_ii__iPiPid__1(3, (&_X1ai_2), (&_X1bi_2), 3.5))) , _tmp_cp_ret8)));
     101        signed int *(*_tmp_cp_ret4)(signed int __param_0, signed int __param_1);
     102        ((void)(_X1xFPi_ii__2=(((void)(_tmp_cp_ret4=_X3f10FFPi_ii__iPiPid__1(3, (&_X1ai_2), (&_X1bi_2), 3.5))) , _tmp_cp_ret4)));
    103103    }
    104104
  • tests/.expect/KRfunctions.x64.txt

    r94aa202 r5780d0d  
    9999    signed int _X1bi_2;
    100100    {
    101         signed int *(*_tmp_cp_ret8)(signed int __param_0, signed int __param_1);
    102         ((void)(_X1xFPi_ii__2=(((void)(_tmp_cp_ret8=_X3f10FFPi_ii__iPiPid__1(3, (&_X1ai_2), (&_X1bi_2), 3.5))) , _tmp_cp_ret8)));
     101        signed int *(*_tmp_cp_ret4)(signed int __param_0, signed int __param_1);
     102        ((void)(_X1xFPi_ii__2=(((void)(_tmp_cp_ret4=_X3f10FFPi_ii__iPiPid__1(3, (&_X1ai_2), (&_X1bi_2), 3.5))) , _tmp_cp_ret4)));
    103103    }
    104104
  • tests/.expect/KRfunctions.x86.txt

    r94aa202 r5780d0d  
    9999    signed int _X1bi_2;
    100100    {
    101         signed int *(*_tmp_cp_ret8)(signed int __param_0, signed int __param_1);
    102         ((void)(_X1xFPi_ii__2=(((void)(_tmp_cp_ret8=_X3f10FFPi_ii__iPiPid__1(3, (&_X1ai_2), (&_X1bi_2), 3.5))) , _tmp_cp_ret8)));
     101        signed int *(*_tmp_cp_ret4)(signed int __param_0, signed int __param_1);
     102        ((void)(_X1xFPi_ii__2=(((void)(_tmp_cp_ret4=_X3f10FFPi_ii__iPiPid__1(3, (&_X1ai_2), (&_X1bi_2), 3.5))) , _tmp_cp_ret4)));
    103103    }
    104104
  • tests/.expect/declarationSpecifier.arm64.txt

    r94aa202 r5780d0d  
    949949    }
    950950
    951     signed int _tmp_cp_ret8;
    952     signed int _X3reti_2 = (((void)(_tmp_cp_ret8=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret8);
     951    signed int _tmp_cp_ret4;
     952    signed int _X3reti_2 = (((void)(_tmp_cp_ret4=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret4);
    953953    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
    954954        {
  • tests/.expect/declarationSpecifier.x64.txt

    r94aa202 r5780d0d  
    949949    }
    950950
    951     signed int _tmp_cp_ret8;
    952     signed int _X3reti_2 = (((void)(_tmp_cp_ret8=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret8);
     951    signed int _tmp_cp_ret4;
     952    signed int _X3reti_2 = (((void)(_tmp_cp_ret4=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret4);
    953953    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
    954954        {
  • tests/.expect/declarationSpecifier.x86.txt

    r94aa202 r5780d0d  
    949949    }
    950950
    951     signed int _tmp_cp_ret8;
    952     signed int _X3reti_2 = (((void)(_tmp_cp_ret8=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret8);
     951    signed int _tmp_cp_ret4;
     952    signed int _X3reti_2 = (((void)(_tmp_cp_ret4=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret4);
    953953    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
    954954        {
  • tests/.expect/extension.arm64.txt

    r94aa202 r5780d0d  
    445445
    446446    {
    447         signed int _tmp_cp_ret8;
    448         ((void)(((void)(_tmp_cp_ret8=__extension__ _X4fredFi_i__1(3))) , _tmp_cp_ret8));
     447        signed int _tmp_cp_ret4;
     448        ((void)(((void)(_tmp_cp_ret4=__extension__ _X4fredFi_i__1(3))) , _tmp_cp_ret4));
    449449    }
    450450
  • tests/.expect/extension.x64.txt

    r94aa202 r5780d0d  
    445445
    446446    {
    447         signed int _tmp_cp_ret8;
    448         ((void)(((void)(_tmp_cp_ret8=__extension__ _X4fredFi_i__1(3))) , _tmp_cp_ret8));
     447        signed int _tmp_cp_ret4;
     448        ((void)(((void)(_tmp_cp_ret4=__extension__ _X4fredFi_i__1(3))) , _tmp_cp_ret4));
    449449    }
    450450
  • tests/.expect/extension.x86.txt

    r94aa202 r5780d0d  
    445445
    446446    {
    447         signed int _tmp_cp_ret8;
    448         ((void)(((void)(_tmp_cp_ret8=__extension__ _X4fredFi_i__1(3))) , _tmp_cp_ret8));
     447        signed int _tmp_cp_ret4;
     448        ((void)(((void)(_tmp_cp_ret4=__extension__ _X4fredFi_i__1(3))) , _tmp_cp_ret4));
    449449    }
    450450
  • tests/.expect/gccExtensions.arm64.txt

    r94aa202 r5780d0d  
    339339    }
    340340
    341     signed int _tmp_cp_ret8;
    342     signed int _X3reti_2 = (((void)(_tmp_cp_ret8=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret8);
     341    signed int _tmp_cp_ret4;
     342    signed int _X3reti_2 = (((void)(_tmp_cp_ret4=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret4);
    343343    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
    344344        {
  • tests/.expect/gccExtensions.x64.txt

    r94aa202 r5780d0d  
    339339    }
    340340
    341     signed int _tmp_cp_ret8;
    342     signed int _X3reti_2 = (((void)(_tmp_cp_ret8=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret8);
     341    signed int _tmp_cp_ret4;
     342    signed int _X3reti_2 = (((void)(_tmp_cp_ret4=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret4);
    343343    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
    344344        {
  • tests/.expect/gccExtensions.x86.txt

    r94aa202 r5780d0d  
    317317    }
    318318
    319     signed int _tmp_cp_ret8;
    320     signed int _X3reti_2 = (((void)(_tmp_cp_ret8=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret8);
     319    signed int _tmp_cp_ret4;
     320    signed int _X3reti_2 = (((void)(_tmp_cp_ret4=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret4);
    321321    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
    322322        {
Note: See TracChangeset for help on using the changeset viewer.