Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1036150 // growArrayByDoubling [dev.]

JavaX fragment (include)

1  
static double[] growArrayByDoubling(double[] data, int neededSize) {
2  
  int size = data.length;
3  
  if (data.length >= neededSize) ret data;
4  
  
5  
  int size = limitToMaximumSafeArraySize(size*2L);
6  
  while (size == lDoubleArray(data)) {
7  
      data = resizeDoubleArray(data, Math.max(1, toInt(Math.min(maximumSafeArraySize(), lDoubleArray(data)*2L))));
8  
      if (size >= data.length) fail("DoubleBuffer too large: " + size);
9  
    }

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036150
Snippet name: growArrayByDoubling [dev.]
Eternal ID of this version: #1036150/1
Text MD5: 91237e3a809dea1b309d980fa6f927bf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-01 05:40:33
Source code size: 431 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 116 / 127
Referenced in: [show references]