Creates a new Uint8Array based on two different ArrayBuffers

@param {ArrayBuffers} buffer1 The first buffer.
@param {ArrayBuffers} buffer2 The second buffer.
@return {ArrayBuffers} The new ArrayBuffer created out of the two.
15489
function appendBuffer(buffer1, buffer2) {
  var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
  tmp.set(new Uint8Array(buffer1), 0);
  tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
  return tmp.buffer;
}
625640
function toUint8Array(object) {
    if (object instanceof Uint8Array) return object;
    if (Array.isArray(object)) return new Uint8Array(object);
    if (('byteOffset' in object) && ('byteLength' in object)) {
      var array = new Array(object.byteLength);
      for (var i = 0; i < object.byteLength; i++) {
        array[i] = object[i + object.byteOffset];
      }
      return new Uint8Array(array);
    }
    throw new Error("Unable to create Uint8Array");
  }
97558
function arrayBufferEquals(ab1, ab2) {
    if (ab1.byteLength !== ab2.byteLength) {
        return false;
    }
    var arr1 = new Uint8Array(ab1);
    var arr2 = new Uint8Array(ab2);
    for (var i = 0, len = arr1.length; i < len; i++) {
        if (arr1[i] !== arr2[i]) {
            return false;
        }
    }
    return true;
}
241155
public static int createDims(FlatBufferBuilder bufferBuilder,INDArray arr) {
        int[] tensorDimOffsets = new int[arr.rank()];
        int[] nameOffset = new int[arr.rank()];
        for(int i = 0; i < tensorDimOffsets.length; i++) {
            nameOffset[i] = bufferBuilder.createString("");
            tensorDimOffsets[i] = TensorDim.createTensorDim(bufferBuilder,arr.size(i),nameOffset[i]);
        }

        return Tensor.createShapeVector(bufferBuilder,tensorDimOffsets);
    }
1221785
function xor(arr1, arr2) {
                var ans = new Array(arr1.length);
                for (var i = 0; i < arr1.length; i++)
                    ans[i] = arr1[i] ^ arr2[i];
                return ans;
            }
181136
function toBuffer(data, encoding) {
    return (typeof Buffer.from === 'function' && Buffer.from !== Uint8Array.from) ?
        Buffer.from(data, encoding) : new Buffer(data, encoding);
}
995839
function makeConcat(chunkType) {
	switch (chunkType) {
	case BUFFER:
		return (a, b) => Buffer.concat([a, b]);
	default:
		return (a, b) => {
			// console.log('[%d, %d]', a.length, b.length);
			const t = new Uint8Array(a.length + b.length);
			t.set(a);
			t.set(b, a.length);
			// console.log('%d: %s', t.length, new Buffer(t).toString('utf8'));
			return t;
		};
	}
}
714826
function create2x2(a, b, c, d){
    if (undef(a)) throw new Error("At least one argument must be provided.");

    if (undef(b)){
        // Everything = a
        b = a;
        c = a;
        d = a;
    }
    else{
        // we have a and b
        if(undef(c)){
            c = a;
            d = b;
        }
        else{
            if(undef(d)) throw new Error("Argument 'd' must be provided if 'c' is.");
        }
    }

    return new Vector([[a, b],[c, d]]);
}
316183
function(arrayBuffer, sliceSize) {
		var segments= [],
			fi = 0;
		while(fi * sliceSize < arrayBuffer.byteLength){
			segments.push(arrayBuffer.slice(fi * sliceSize, (fi + 1) * sliceSize));
			fi++;
		}
		return segments;
	}
919551
function(b1, b2) {
  var mismatch = 0;
  mismatch |= !(b1 instanceof Buffer);
  mismatch |= !(b2 instanceof Buffer);
  mismatch |= b1.length !== b2.length;
  if (mismatch === 1) {
    return false;
  }
  var n = b1.length;
  for (var i = 0; i < n; i++) {
    mismatch |= b1[i] ^ b2[i];
  }
  return mismatch === 0;
}
1259556
function amf0encArray(a) {
    var l = 0;
    if (a instanceof Array) l = a.length; else l = Object.keys(a).length;
    console.log('Array encode', l, a);
    var buf = new Buffer(5);
    buf.writeUInt8(8,0);
    buf.writeUInt32BE(l,1);
    var data = amf0encObject(a);
    return Buffer.concat([buf,data.slice(1)]);
}
96624
function __deserializeUInt8(buffer, start, options) {
	let end = start + 1;
	let dataView = new DataView(buffer);
	let data = dataView.getUint8(start);
	return { anchor: end, value:options.use_native_types ? data : UInt8.from(data) };
}
903886
function stringToBuffer(data) {
    return (typeof Buffer.from === 'function' && Buffer.from !== Uint8Array.from) ?
        Buffer.from(data) : new Buffer(data);
}
720203
function getCommonArray(array1, array2, width) {
  var newArray = [[], []];
  var pos2 = 0;
  width /= 2;
  var j = 0;
  var array1Length = array1[0] ? array1[0].length : 0;
  var array2Length = array2[0] ? array2[0].length : 0;

  for (var i = 0; i < array1Length; i++) {
    while (pos2 < array2Length && (array1[0][i] > (array2[0][pos2] + width))) {
      pos2++;
    }
    if ((pos2 < array2Length) && (array1[0][i] > array2[0][pos2] - width)) {
      newArray[0][j] = array1[0][i];
      newArray[1][j] = array1[1][i];
      j++;
    }
  }
  return newArray;
}
1248701
function compareBufferArrays(buffArray1, buffArray2) {
  assert(Array.isArray(buffArray1), 'We only accept arrays.');
  assert(Array.isArray(buffArray2), 'We only accept arrays.');
  if (buffArray1.length !== buffArray2.length) {
    return false;
  }
  for (var i = 0; i < buffArray1.length; ++i) {
    var buff1 = buffArray1[i];
    assert(Buffer.isBuffer(buff1), 'Only buffers allowed in 1');
    var buff2 = buffArray2[i];
    assert(Buffer.isBuffer(buff2), 'Only buffers allowed in 2');
    if (Buffer.compare(buff1, buff2) !== 0) {
      return false;
    }
  }
  return true;
}
177499
function stringToArrayBuffer(string) {
            var
                buffer = new ArrayBuffer(string.length),
                int8Array = new Uint8Array(buffer);
            
            for (var i = 0; i < string.length; i++) {
                int8Array[i] = string.charCodeAt(i);
            }
            
            return buffer;
        }
395652
function uint8ArrayToArrayBuffer (arr) {
  return arr.buffer.slice(arr.byteOffset, arr.byteLength + arr.byteOffset)
}