Specialized array serialization for UInt8 Arrays
480373
function UInt8ArraySerializer(array, buffer, bufferOffset, specArrayLen=null) {
  const arrLen = array.length;

  if (specArrayLen === null || specArrayLen < 0) {
    bufferOffset = buffer.writeUInt32LE(arrLen, bufferOffset, true);
  }

  buffer.set(array, bufferOffset);
  return bufferOffset + arrLen;
}
187168
function amf0cnvObject2Array(oData) {
    var buf = new Buffer(5);
    var o = amf0decObject(oData);
    var l = Object.keys(o).length;
    buf.writeUInt32BE(l,1);
    return Buffer.concat([buf,oData.slice(1)]);
}
1163397
function encode_8bit(data) {
    var len = data.length;
    var bits = [];

    for (var i = 0; i < len; i++) {
        pushBits(bits, 8, data[i]);
    }

    var res = {};

    var d = [0, 1, 0, 0];
    pushBits(d, 16, len);
    res.data10 = res.data27 = d.concat(bits);

    if (len < 256) {
        var d = [0, 1, 0, 0];
        pushBits(d, 8, len);
        res.data1 = d.concat(bits);
    }

    return res;
}
622699
function toArrayLike(buf) {
  if (buf instanceof Uint8Array) {
    return buf;
  } else if (buf instanceof ArrayBuffer) {
    return new Uint8Array(buf);
  } else if (Buffer.isBuffer(buf)) {
    return buf;
  } else {
    return buf; // type unknown, trust the user
  }
}
1291061
def be_array_from_bytes(fmt, data):
    
    arr = array.array(str(fmt), data)
    return fix_byteorder(arr)
1158095
function toArray(buffer) {
    if(!buffer) buffer = new Buffer(0);
    var view = new Uint8Array(buffer.length);
    for (var i = 0; i < buffer.length; ++i) {
        view[i] = buffer[i];
    }
    return view;
  }
604683
function _initArray() {
    if (typeof Uint32Array !== 'undefined') {
        _bitrev = new Uint32Array(_n);
    } else {
        _bitrev = [];
    }
    if (typeof Float64Array !== 'undefined') {
        _cstb = new Float64Array(_n * 1.25);
    } else {
        _cstb = [];
    }
}
632056
def WriteSerializableArray(self, array):
        
        if array is None:
            self.WriteByte(0)
        else:
            self.WriteVarInt(len(array))
            for item in array:
                item.Serialize(self)
346151
function cloneArrayBuffer(arrayBuffer) {
    var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
    new Uint8Array(result).set(new Uint8Array(arrayBuffer));
    return result;
  }
298742
function __deserializeIntVar(buffer, start, options) {
	const dataBuff = new Uint8Array(buffer);
	if ( dataBuff[start] > 127 ) {
		throw new Error( "Cannot support IntVar whose size is greater than 127 bytes" );
	}
	
	
	
	let index = 0, data_size = dataBuff[start], end = start + 1;
	const result_buffer = new Uint8Array(data_size);
	while( data_size-- > 0 ) {
		result_buffer[index] = dataBuff[end];
		index++; end++;
	}


	let data = new IntVar(result_buffer);
	return { anchor: end, value: data };
}
862901
function getPaddedArrayBuffer(arrayBuffer, paddingByte) {
      paddingByte = paddingByte || 0;

      var paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);

      if (paddedLength !== arrayBuffer.byteLength) {
        var array = new Uint8Array(paddedLength);
        array.set(new Uint8Array(arrayBuffer));

        if (paddingByte !== 0) {
          for (var i = arrayBuffer.byteLength; i < paddedLength; i++) {
            array[i] = paddingByte;
          }
        }

        return array.buffer;
      }

      return arrayBuffer;
    }
82278
private String _serializeArray(Array array, Set<Object> done) throws ConverterException {
	return _serializeList(array.toList(), done);
    }
635693
function __deserializeInt8(buffer, start, options) {
	let end = start + 1;
	let dataView = new DataView(buffer);
	let data = dataView.getInt8(start);
	return { anchor: end, value:options.use_native_types ? data : Int8.from(data) };
}
190310
function toArrayBuffer(buf) {
  if (buf.byteLength === buf.buffer.byteLength) {
    return buf.buffer;
  }

  return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
}
453647
function __arrayBufferConcat(buffers) {
	let totalLength = 0;
	for (const buffer of buffers) {
		totalLength += buffer.byteLength;
	}
	const result = new Uint8Array(totalLength);
	let offset = 0;
	for (const buffer of buffers) {
		result.set(new Uint8Array(buffer), offset);
		offset += buffer.byteLength;
	}
	return result.buffer;
}
164694
function blockmix_salsa8(BY, Yi, r, x, _X) {
        var i;

        arraycopy(BY, (2 * r - 1) * 16, _X, 0, 16);
        for (i = 0; i < 2 * r; i++) {
            blockxor(BY, i * 16, _X, 16);
            salsa20_8(_X, x);
            arraycopy(_X, 0, BY, Yi + (i * 16), 16);
        }

        for (i = 0; i < r; i++) {
            arraycopy(BY, Yi + (i * 2) * 16, BY, (i * 16), 16);
        }

        for (i = 0; i < r; i++) {
            arraycopy(BY, Yi + (i * 2 + 1) * 16, BY, (i + r) * 16, 16);
        }
    }
948876
function initReversedBytes() {
	var i,
	    result = new Uint8Array( 0x100 );

	for ( i = 0; i < 0x100; i++ ) {
		result[ i ] = calcReverse( i );
	}

	return result;

	function calcReverse( original ) {
		var i,
			reverse = 0;

		for ( i = 7; i >= 0; i-- ) {
			reverse |= ( ( original & 1 ) << i );
			original >>>= 1;
		}

		return reverse;
	}
}