swap method

void swap (Float64List array)

Inverts the order of array in place. Reverses the order of array in place. Example: 1,2,3,4,5,6,7,8,9,10 => 10,9,8,7,6,5,4,3,2,1 See also method swapHalf.

Implementation

static void swap(Float64List array) {
  int right;
  double temp;
  int halfsize = array.length;

  // reverse array
  for (int i = 0; i < halfsize ~/ 2; i++) {
    right = halfsize - 1 - i;
    temp = array[i];
    array[i] = array[right];
    array[right] = temp;
  }
}