Changeset 0d8266c


Ignore:
Timestamp:
Jun 26, 2019, 5:27:02 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
2233ad4
Parents:
6887a99
Message:

add polymorphic "not" (bang) to work with != 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r6887a99 r0d8266c  
    1010// Created On       : Fri Jul 21 16:21:03 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 26 23:10:36 2019
    13 // Update Count     : 95
     12// Last Modified On : Tue Jun 25 18:06:52 2019
     13// Update Count     : 97
    1414//
    1515
     
    4949void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    5050
    51 // increment/decrement unification
     51// implicit increment, decrement if += defined, and implicit not if != defined
    5252
    5353static inline {
     
    6363        forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?-=?( DT &, one_t ); } )
    6464        DT & ?--( DT & x ) { DT tmp = x; x -= 1; return tmp; }
     65
     66        forall( dtype DT | { int ?!=?( const DT &, zero_t ); } )
     67        int !?( const DT & x ) { return !( x != 0 ); }
    6568} // distribution
    6669
Note: See TracChangeset for help on using the changeset viewer.