mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8198955: String#repeat loop optimization
Reviewed-by: rriggs, redestad, igerasim
This commit is contained in:
parent
c43cebb5cf
commit
522a9d15fd
1 changed files with 1 additions and 2 deletions
|
@ -3005,9 +3005,8 @@ public final class String
|
|||
final byte[] multiple = new byte[limit];
|
||||
System.arraycopy(value, 0, multiple, 0, len);
|
||||
int copied = len;
|
||||
for (int next = copied << 1; next < limit && 0 < next; next = next << 1) {
|
||||
for (; copied < limit - copied; copied <<= 1) {
|
||||
System.arraycopy(multiple, 0, multiple, copied, copied);
|
||||
copied = next;
|
||||
}
|
||||
System.arraycopy(multiple, 0, multiple, copied, limit - copied);
|
||||
return new String(multiple, coder);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue