AllocAlignment constructor

AllocAlignment({
  1. required int pow,
})

Creates an alignment of 2^pow bytes.

Throws ArgumentError unless pow is in canon's uint8_t domain, 0..255. Rejecting here rather than at each allocation call means an out-of-domain value can never reach the FFI seam at all: there is no way to build a value that carries one.

Implementation

AllocAlignment({required this.pow}) {
  if (pow < 0 || pow > 255) {
    throw ArgumentError.value(
      pow,
      'pow',
      "must be in canon's uint8_t domain, 0..255",
    );
  }
}