Changeset 8ee211d for libcfa/src/collections/array.hfa
- Timestamp:
- Dec 12, 2024, 4:45:14 PM (6 days ago)
- Branches:
- master
- Children:
- ad8b6df
- Parents:
- 35cc6d4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/array.hfa
r35cc6d4 r8ee211d 9 9 10 10 #ifdef __CFA_DEBUG__ 11 #define subcheck( arr, sub, lb, ub ) \ 12 if ( (sub) < (lb) || (sub) >= (ub) ) \ 13 abort( "subscript %ld exceeds dimension range [%d,%zd) for array %p.\n", \ 14 (sub), (lb), (ub), (arr) ) 11 #define subcheck( arr, sub, len ) \ 12 if ( (sub) < 0 || (sub) >= (len) ) \ 13 abort( "subscript %ld exceeds dimension range [0,%zd) for array %p.\n", \ 14 (sub), (len), (arr) ) 15 #define subchecku( arr, sub, len ) \ 16 if ( (sub) >= (len) ) \ 17 abort( "subscript %ld exceeds dimension range [0,%zd) for array %p.\n", \ 18 (sub), (len), (arr) ) 15 19 #else 16 #define subcheck( arr, sub, lb, ub ) do {} while (0) 20 #define subcheck( arr, sub, len ) do {} while (0) 21 #define subchecku( arr, sub, len ) do {} while (0) 17 22 #endif 18 23 … … 84 89 85 90 static inline Timmed & ?[?]( arpk( N, S, Timmed, Tbase ) & a, zero_t ) { 86 //assert( 0 < N ); 87 subcheck( a, 0L, 0, N ); 91 subcheck( a, 0L, N ); 88 92 return (Timmed &)a.strides[0]; 89 93 } 90 94 91 95 static inline Timmed & ?[?]( arpk( N, S, Timmed, Tbase ) & a, one_t ) { 92 //assert( 1 < N ); 93 subcheck( a, 1L, 0, N ); 96 subcheck( a, 1L, N ); 94 97 return (Timmed &)a.strides[1]; 95 98 } 96 99 97 100 static inline Timmed & ?[?]( arpk( N, S, Timmed, Tbase ) & a, int i ) { 98 //assert( i < N ); 99 subcheck( a, (long int)i, 0, N ); 101 subcheck( a, (long int)i, N ); 100 102 return (Timmed &)a.strides[i]; 101 103 } 102 104 103 105 static inline const Timmed & ?[?]( const arpk( N, S, Timmed, Tbase ) & a, int i ) { 104 //assert( i < N ); 105 subcheck( a, (long int)i, 0, N ); 106 subcheck( a, (long int)i, N ); 106 107 return (Timmed &)a.strides[i]; 107 108 } 108 109 109 110 static inline Timmed & ?[?]( arpk( N, S, Timmed, Tbase ) & a, unsigned int i ) { 110 //assert( i < N ); 111 subcheck( a, (long int)i, 0, N ); 111 subchecku( a, (unsigned long int)i, N ); 112 112 return (Timmed &)a.strides[i]; 113 113 } 114 114 115 115 static inline const Timmed & ?[?]( const arpk( N, S, Timmed, Tbase ) & a, unsigned int i ) { 116 //assert( i < N ); 117 subcheck( a, (unsigned long int)i, 0, N ); 116 subchecku( a, (unsigned long int)i, N ); 118 117 return (Timmed &)a.strides[i]; 119 118 } 120 119 121 120 static inline Timmed & ?[?]( arpk( N, S, Timmed, Tbase ) & a, long int i ) { 122 //assert( i < N ); 123 subcheck( a, i, 0, N ); 121 subcheck( a, i, N ); 124 122 return (Timmed &)a.strides[i]; 125 123 } 126 124 127 125 static inline const Timmed & ?[?]( const arpk( N, S, Timmed, Tbase ) & a, long int i ) { 128 //assert( i < N ); 129 subcheck( a, i, 0, N ); 126 subcheck( a, i, N ); 130 127 return (Timmed &)a.strides[i]; 131 128 } 132 129 133 130 static inline Timmed & ?[?]( arpk( N, S, Timmed, Tbase ) & a, unsigned long int i ) { 134 //assert( i < N ); 135 subcheck( a, i, 0, N ); 131 subchecku( a, i, N ); 136 132 return (Timmed &)a.strides[i]; 137 133 } 138 134 139 135 static inline const Timmed & ?[?]( const arpk( N, S, Timmed, Tbase ) & a, unsigned long int i ) { 140 //assert( i < N ); 141 subcheck( a, i, 0, N ); 142 return (Timmed &)a.strides[i]; 143 } 144 145 static inline size_t ?`len( arpk( N, S, Timmed, Tbase ) & a ) { 136 subchecku( a, i, N ); 137 return (Timmed &)a.strides[i]; 138 } 139 140 static inline size_t ?`len( arpk( N, S, Timmed, Tbase ) & ) { 146 141 return N; 147 142 }
Note: See TracChangeset
for help on using the changeset viewer.