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

9
LINES

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

JavaX fragment (include)

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

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: 7 / 9
Referenced in: [show references]