WASIComponentAsyncEndpointHandles.unpack constructor

WASIComponentAsyncEndpointHandles.unpack(
  1. int packed
)

Unpacks the canonical i64 handle pair used by stream/future.new.

Implementation

factory WASIComponentAsyncEndpointHandles.unpack(int packed) {
  _checkI64Bits(packed, 'packed');
  final signedHigh = _floorDivideByU32Base(packed);
  final writable = signedHigh < 0 ? signedHigh + _u32Base : signedHigh;
  return WASIComponentAsyncEndpointHandles(
    readable: packed - signedHigh * _u32Base,
    writable: writable,
  );
}