src/array_list.c

changeset 1019
09c6fe8fe3b9
parent 1018
c773da859bad
child 1022
2911c1f4a570
equal deleted inserted replaced
1018:c773da859bad 1019:09c6fe8fe3b9
163 163
164 // store new capacity 164 // store new capacity
165 if (width == 0 || width == CX_WORDSIZE) { 165 if (width == 0 || width == CX_WORDSIZE) {
166 *(size_t*) capacity = newcap; 166 *(size_t*) capacity = newcap;
167 } else if (width == 16) { 167 } else if (width == 16) {
168 *(uint16_t*) capacity = newcap; 168 *(uint16_t*) capacity = (uint16_t) newcap;
169 } else if (width == 8) { 169 } else if (width == 8) {
170 *(uint8_t*) capacity = newcap; 170 *(uint8_t*) capacity = (uint8_t) newcap;
171 } 171 }
172 #if CX_WORDSIZE == 64 172 #if CX_WORDSIZE == 64
173 else if (width == 32) { 173 else if (width == 32) {
174 *(uint32_t*) capacity = newcap; 174 *(uint32_t*) capacity = (uint32_t) newcap;
175 } 175 }
176 #endif 176 #endif
177 } 177 }
178 178
179 return 0; 179 return 0;
280 if (newsize != oldsize || newcap != oldcap) { 280 if (newsize != oldsize || newcap != oldcap) {
281 if (width == 0 || width == CX_WORDSIZE) { 281 if (width == 0 || width == CX_WORDSIZE) {
282 *(size_t*) capacity = newcap; 282 *(size_t*) capacity = newcap;
283 *(size_t*) size = newsize; 283 *(size_t*) size = newsize;
284 } else if (width == 16) { 284 } else if (width == 16) {
285 *(uint16_t*) capacity = newcap; 285 *(uint16_t*) capacity = (uint16_t) newcap;
286 *(uint16_t*) size = newsize; 286 *(uint16_t*) size = (uint16_t) newsize;
287 } else if (width == 8) { 287 } else if (width == 8) {
288 *(uint8_t*) capacity = newcap; 288 *(uint8_t*) capacity = (uint8_t) newcap;
289 *(uint8_t*) size = newsize; 289 *(uint8_t*) size = (uint8_t) newsize;
290 } 290 }
291 #if CX_WORDSIZE == 64 291 #if CX_WORDSIZE == 64
292 else if (width == 32) { 292 else if (width == 32) {
293 *(uint32_t*) capacity = newcap; 293 *(uint32_t*) capacity = (uint32_t) newcap;
294 *(uint32_t*) size = newsize; 294 *(uint32_t*) size = (uint32_t) newsize;
295 } 295 }
296 #endif 296 #endif
297 } 297 }
298 298
299 // return successfully 299 // return successfully

mercurial