if (offset >= len) {
return
} else if (offset + 1 === len) {
- var dv = new DataView(new ArrayBuffer(2))
+ var dv = new xDataView(new xArrayBuffer(2))
dv.setUint8(0, buf[len - 1])
return dv.getUint16(0, littleEndian)
} else {
if (offset >= len) {
return
} else if (offset + 3 >= len) {
- var dv = new DataView(new ArrayBuffer(4))
+ var dv = new xDataView(new xArrayBuffer(4))
for (var i = 0; i + offset < len; i++) {
dv.setUint8(i, buf[i + offset])
}
if (offset >= len) {
return
} else if (offset + 1 === len) {
- var dv = new DataView(new ArrayBuffer(2))
+ var dv = new xDataView(new xArrayBuffer(2))
dv.setUint8(0, buf[len - 1])
return dv.getInt16(0, littleEndian)
} else {
if (offset >= len) {
return
} else if (offset + 3 >= len) {
- var dv = new DataView(new ArrayBuffer(4))
+ var dv = new xDataView(new xArrayBuffer(4))
for (var i = 0; i + offset < len; i++) {
dv.setUint8(i, buf[i + offset])
}
if (offset >= len) {
return
} else if (offset + 1 === len) {
- var dv = new DataView(new ArrayBuffer(2))
+ var dv = new xDataView(new xArrayBuffer(2))
dv.setUint16(0, value, littleEndian)
buf[offset] = dv.getUint8(0)
} else {
if (offset >= len) {
return
} else if (offset + 3 >= len) {
- var dv = new DataView(new ArrayBuffer(4))
+ var dv = new xDataView(new xArrayBuffer(4))
dv.setUint32(0, value, littleEndian)
for (var i = 0; i + offset < len; i++) {
buf[i + offset] = dv.getUint8(i)
if (offset >= len) {
return
} else if (offset + 1 === len) {
- var dv = new DataView(new ArrayBuffer(2))
+ var dv = new xDataView(new xArrayBuffer(2))
dv.setInt16(0, value, littleEndian)
buf[offset] = dv.getUint8(0)
} else {
if (offset >= len) {
return
} else if (offset + 3 >= len) {
- var dv = new DataView(new ArrayBuffer(4))
+ var dv = new xDataView(new xArrayBuffer(4))
dv.setInt32(0, value, littleEndian)
for (var i = 0; i + offset < len; i++) {
buf[i + offset] = dv.getUint8(i)
if (offset >= len) {
return
} else if (offset + 3 >= len) {
- var dv = new DataView(new ArrayBuffer(4))
+ var dv = new xDataView(new xArrayBuffer(4))
dv.setFloat32(0, value, littleEndian)
for (var i = 0; i + offset < len; i++) {
buf[i + offset] = dv.getUint8(i)
if (offset >= len) {
return
} else if (offset + 7 >= len) {
- var dv = new DataView(new ArrayBuffer(8))
+ var dv = new xDataView(new xArrayBuffer(8))
dv.setFloat64(0, value, littleEndian)
for (var i = 0; i + offset < len; i++) {
buf[i + offset] = dv.getUint8(i)
this._arr = arr
if (arr.byteLength !== 0)
- this._dataview = new DataView(arr.buffer, arr.byteOffset, arr.byteLength)
+ this._dataview = new xDataView(arr.buffer, arr.byteOffset, arr.byteLength)
}
ProxyBuffer.prototype.write = BufferWrite
arr._isBuffer = true
if (arr.byteLength !== 0)
- arr._dataview = new DataView(arr.buffer, arr.byteOffset, arr.byteLength)
+ arr._dataview = new xDataView(arr.buffer, arr.byteOffset, arr.byteLength)
return arr
function assert (test, message) {
if (!test) throw new Error(message || 'Failed assertion')
-}
\ No newline at end of file
+}