Changes in libcfa/src/containers/array.hfa [6448f7d:63f42a8]
- File:
-
- 1 edited
-
libcfa/src/containers/array.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/containers/array.hfa
r6448f7d r63f42a8 1 1 2 2 3 forall( __CFA_tysys_id_only_X & ) struct tag {}; 3 // a type whose size is n 4 #define Z(n) char[n] 5 6 // the inverse of Z(-) 7 #define z(N) sizeof(N) 8 9 forall( T & ) struct tag {}; 4 10 #define ttag(T) ((tag(T)){}) 5 #define ztag(n) ttag( n)11 #define ztag(n) ttag(Z(n)) 6 12 7 13 … … 12 18 forall( [N], S & | sized(S), Timmed &, Tbase & ) { 13 19 struct arpk { 14 S strides[ N];20 S strides[z(N)]; 15 21 }; 16 22 … … 50 56 51 57 static inline size_t ?`len( arpk(N, S, Timmed, Tbase) & a ) { 52 return N;58 return z(N); 53 59 } 54 60 55 61 // workaround #226 (and array relevance thereof demonstrated in mike102/otype-slow-ndims.cfa) 56 62 static inline void ?{}( arpk(N, S, Timmed, Tbase) & this ) { 57 void ?{}( S (&inner)[ N] ) {}63 void ?{}( S (&inner)[z(N)] ) {} 58 64 ?{}(this.strides); 59 65 } 60 66 static inline void ^?{}( arpk(N, S, Timmed, Tbase) & this ) { 61 void ^?{}( S (&inner)[ N] ) {}67 void ^?{}( S (&inner)[z(N)] ) {} 62 68 ^?{}(this.strides); 63 69 } … … 137 143 // Base 138 144 forall( [Nq], Sq & | sized(Sq), Tbase & ) 139 static inline tag(arpk(Nq, Sq, Tbase, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(Tbase) ) { 140 tag(arpk(Nq, Sq, Tbase, Tbase)) ret; 141 return ret; 142 } 145 static inline tag(arpk(Nq, Sq, Tbase, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(Tbase) ) {} 143 146 144 147 // Rec 145 148 forall( [Nq], Sq & | sized(Sq), [N], S & | sized(S), recq &, recr &, Tbase & | { tag(recr) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(recq) ); } ) 146 static inline tag(arpk(N, S, recr, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(arpk(N, S, recq, Tbase)) ) { 147 tag(arpk(N, S, recr, Tbase)) ret; 148 return ret; 149 } 149 static inline tag(arpk(N, S, recr, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(arpk(N, S, recq, Tbase)) ) {} 150 150 151 151 // Wrapper
Note:
See TracChangeset
for help on using the changeset viewer.