wordSize property Null safety

  1. @override
int wordSize
override

Implementation

@override
int get wordSize => _wordSize;
void wordSize=(int v)

Set the word size, and fix up the values on the stack for the new size. A size of 0 is interpreted as 64, as per the 16C.

Implementation

set wordSize(int v) {
  _doubleWordStatus = null;
  if (v == 0) {
    v = 64;
  }
  if (v < 1 || v > 64) {
    throw CalculatorError(2);
  }
  if (v != _wordSize) {
    final BigInt newMask = (BigInt.one << v) - BigInt.one;
    lastX = lastX.changeBitSize(newMask);
    for (int i = 0; i < _stack.length; i++) {
      _stack[i] = _stack[i].changeBitSize(newMask);
    }
    _wordSize = v;
    _wordMask = newMask;
    _signMask = BigInt.one << (v - 1);
    display.window = 0;
  }
  display.displayX(); // If v unchanged, still want the blink.
  needsSave = true;
}