Ignore:
Timestamp:
Oct 19, 2022, 4:33:34 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
135143ba
Parents:
72b5805e
Message:

Change parse args to use new arrays instead of C arrays.
Also added const ?? to arrays.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/containers/array.hfa

    r72b5805e rd1abc63c  
    2727    // -  Given bug of Trac #247, CFA gives sizeof expressions type unsigned long int, when it
    2828    //    should give them type size_t.
    29     //   
     29    //
    3030    //                          gcc -m32         cfa -m32 given bug         gcc -m64
    3131    // ptrdiff_t                int              int                        long int
     
    3939    }
    4040
     41    static inline const Timmed & ?[?]( const arpk(N, S, Timmed, Tbase) & a, int i ) {
     42        assert( i < N );
     43        return (Timmed &) a.strides[i];
     44    }
     45
    4146    static inline Timmed & ?[?]( arpk(N, S, Timmed, Tbase) & a, unsigned int i ) {
     47        assert( i < N );
     48        return (Timmed &) a.strides[i];
     49    }
     50
     51    static inline const Timmed & ?[?]( const arpk(N, S, Timmed, Tbase) & a, unsigned int i ) {
    4252        assert( i < N );
    4353        return (Timmed &) a.strides[i];
     
    4959    }
    5060
     61    static inline const Timmed & ?[?]( const arpk(N, S, Timmed, Tbase) & a, long int i ) {
     62        assert( i < N );
     63        return (Timmed &) a.strides[i];
     64    }
     65
    5166    static inline Timmed & ?[?]( arpk(N, S, Timmed, Tbase) & a, unsigned long int i ) {
     67        assert( i < N );
     68        return (Timmed &) a.strides[i];
     69    }
     70
     71    static inline const Timmed & ?[?]( const arpk(N, S, Timmed, Tbase) & a, unsigned long int i ) {
    5272        assert( i < N );
    5373        return (Timmed &) a.strides[i];
     
    83103    // Make a FOREACH macro
    84104    #define FE_0(WHAT)
    85     #define FE_1(WHAT, X) WHAT(X) 
     105    #define FE_1(WHAT, X) WHAT(X)
    86106    #define FE_2(WHAT, X, ...) WHAT(X)FE_1(WHAT, __VA_ARGS__)
    87107    #define FE_3(WHAT, X, ...) WHAT(X)FE_2(WHAT, __VA_ARGS__)
     
    90110    //... repeat as needed
    91111
    92     #define GET_MACRO(_0,_1,_2,_3,_4,_5,NAME,...) NAME 
     112    #define GET_MACRO(_0,_1,_2,_3,_4,_5,NAME,...) NAME
    93113    #define FOR_EACH(action,...) \
    94114    GET_MACRO(_0,__VA_ARGS__,FE_5,FE_4,FE_3,FE_2,FE_1,FE_0)(action,__VA_ARGS__)
     
    115135}
    116136
    117 #else 
     137#else
    118138
    119139// Workaround form.  Listing all possibilities up to 4 dims.
Note: See TracChangeset for help on using the changeset viewer.