Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r62595b31 rb006c51e  
    1010// Created On       : Fri Jul 21 16:21:03 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov  8 17:07:15 2024
    13 // Update Count     : 144
     12// Last Modified On : Thu Feb  2 11:33:56 2023
     13// Update Count     : 135
    1414//
    1515
     
    140140        ) \
    141141        typeof(x) op = 1;                                                                       /* accumulate odd product */ \
    142         typeof(x) w = x; /* FIX-ME: possible bug in the box pass changing value argument through parameter */ \
    143142        for ( ; y > 1; y >>= 1 ) {                                                      /* squaring exponentiation, O(log2 y) */ \
    144                 if ( (y & 1) == 1 ) op = op * w;                                /* odd ? */ \
    145                 w = w * w; \
     143                if ( (y & 1) == 1 ) op = op * x;                                /* odd ? */ \
     144                x = x * x; \
    146145        } \
    147         return w * op
     146        return x * op
    148147#define __CFA_EXP_INT__(...) __VA_ARGS__
    149148
     
    185184static inline quasi_void ?=?(quasi_void &, quasi_void & _src) { return _src; }
    186185
     186forall( E ) trait Bounded {
     187        E lowerBound(void);
     188        E upperBound(void);
     189};
     190
     191forall( E | Bounded( E ) ) trait Serial {
     192        int fromInstance( E e );
     193        E fromInt_unsafe( int i );
     194        E succ_unsafe( E e );
     195        E pred_unsafe( E e );
     196};
     197
     198forall( E | Serial( E ) ) {
     199        E fromInt( int i );
     200        E succ( E e );
     201        E pred( E e );
     202        int Countof( E );
     203}
     204
     205
     206forall( E ) trait CfaEnum {
     207        const char * label( E e );
     208        int posn( E e );
     209};
     210
     211forall( E, V | CfaEnum( E ) ) trait TypedEnum {
     212        V value( E e );
     213};
     214
    187215// Local Variables: //
    188216// mode: c //
Note: See TracChangeset for help on using the changeset viewer.