propertyLength static method

int propertyLength(
  1. int address
)

Implementation

static int propertyLength(int address) {
  if (address == 0) return 0;

  var fb = Z.engine.mem.loadb(address);

  if (ZMachine.verToInt(Z.engine.version) <= 3) {
    return ((fb >> 5) & 0x07) + 1;
  } else {
    if (BinaryHelper.isSet(fb, 7)) {
      //(ref 12.4.2.1)
      var value = BinaryHelper.bottomBits(fb, 6);
      // (ref 12.4.2.1.1)
      return value > 0 ? value : 64;
    } else {
      //(ref 12.4.2.2)
      return BinaryHelper.isSet(fb, 6) ? 2 : 1;
    }
  }
}