emitInsert function

Uint8List emitInsert(
  1. Uint8List opcodes,
  2. Uint8List buffer,
  3. int length
)

Implementation

Uint8List emitInsert(Uint8List opcodes, Uint8List buffer, int length) {
  var i;

  if (length > 127) {
    // TODO: Implement from the go code
    throw Exception('invalid insert opcode');
  }

  opcodes.add(length);

  for (i = 0; i < length; i++) {
    opcodes.add(buffer[i]);
  }

  return opcodes;
}