sumSquaresLanePartial method

int sumSquaresLanePartial(
  1. int size
)

Sum part of the lane squares, until size.

Implementation

int sumSquaresLanePartial(int size) {
  switch (size) {
    case 1:
      return (x * x);
    case 2:
      return (x * x) + (y * y);
    case 3:
      return (x * x) + (y * y) + (z * z);
    case 4:
      return (x * x) + (y * y) + (z * z) + (w * w);
    default:
      throw StateError('Invalid length: $size / 4');
  }
}