Mercurial > hg > truffle
comparison src/share/vm/utilities/growableArray.hpp @ 20340:fbc31318922c hs25.40-b06
Merge
author | amurillo |
---|---|
date | Thu, 21 Aug 2014 14:42:54 -0700 |
parents | 411e30e5fbb8 |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
20322:4d5c3760ebb4 | 20340:fbc31318922c |
---|---|
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 // inserts the given element before the element at index i | 350 // inserts the given element before the element at index i |
351 void insert_before(const int idx, const E& elem) { | 351 void insert_before(const int idx, const E& elem) { |
352 assert(0 <= idx && idx <= _len, "illegal index"); | |
352 check_nesting(); | 353 check_nesting(); |
353 if (_len == _max) grow(_len); | 354 if (_len == _max) grow(_len); |
354 for (int j = _len - 1; j >= idx; j--) { | 355 for (int j = _len - 1; j >= idx; j--) { |
355 _data[j + 1] = _data[j]; | 356 _data[j + 1] = _data[j]; |
356 } | 357 } |
358 _data[idx] = elem; | 359 _data[idx] = elem; |
359 } | 360 } |
360 | 361 |
361 void appendAll(const GrowableArray<E>* l) { | 362 void appendAll(const GrowableArray<E>* l) { |
362 for (int i = 0; i < l->_len; i++) { | 363 for (int i = 0; i < l->_len; i++) { |
363 raw_at_put_grow(_len, l->_data[i], 0); | 364 raw_at_put_grow(_len, l->_data[i], E()); |
364 } | 365 } |
365 } | 366 } |
366 | 367 |
367 void sort(int f(E*,E*)) { | 368 void sort(int f(E*,E*)) { |
368 qsort(_data, length(), sizeof(E), (_sort_Fn)f); | 369 qsort(_data, length(), sizeof(E), (_sort_Fn)f); |