Changeset 660665f for libcfa/src/containers/array.hfa
- Timestamp:
- Jun 29, 2021, 5:35:19 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- dcad80a
- Parents:
- 5a46e09 (diff), d02e547 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/containers/array.hfa
r5a46e09 r660665f 1 1 2 2 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 {}; 3 forall( __CFA_tysys_id_only_X & ) struct tag {}; 10 4 #define ttag(T) ((tag(T)){}) 11 #define ztag(n) ttag( Z(n))5 #define ztag(n) ttag(n) 12 6 13 7 … … 18 12 forall( [N], S & | sized(S), Timmed &, Tbase & ) { 19 13 struct arpk { 20 S strides[ z(N)];14 S strides[N]; 21 15 }; 22 16 … … 56 50 57 51 static inline size_t ?`len( arpk(N, S, Timmed, Tbase) & a ) { 58 return z(N);52 return N; 59 53 } 60 54 61 55 // workaround #226 (and array relevance thereof demonstrated in mike102/otype-slow-ndims.cfa) 62 56 static inline void ?{}( arpk(N, S, Timmed, Tbase) & this ) { 63 void ?{}( S (&inner)[ z(N)] ) {}57 void ?{}( S (&inner)[N] ) {} 64 58 ?{}(this.strides); 65 59 } 66 60 static inline void ^?{}( arpk(N, S, Timmed, Tbase) & this ) { 67 void ^?{}( S (&inner)[ z(N)] ) {}61 void ^?{}( S (&inner)[N] ) {} 68 62 ^?{}(this.strides); 69 63 } … … 143 137 // Base 144 138 forall( [Nq], Sq & | sized(Sq), Tbase & ) 145 static inline tag(arpk(Nq, Sq, Tbase, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(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 } 146 143 147 144 // Rec 148 145 forall( [Nq], Sq & | sized(Sq), [N], S & | sized(S), recq &, recr &, Tbase & | { tag(recr) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(recq) ); } ) 149 static inline tag(arpk(N, S, recr, Tbase)) enq_( tag(Tbase), tag(Nq), tag(Sq), tag(arpk(N, S, recq, Tbase)) ) {} 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 } 150 150 151 151 // Wrapper
Note: See TracChangeset
for help on using the changeset viewer.