How to use the int64-buffer.Int64LE function in int64-buffer

To help you get started, we’ve selected a few int64-buffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commaai / cabana / src / workers / can-fetcher.js View on Github external
dbc,
  base,
  num,
  canStartTime,
  prevMsgEntries,
  maxByteStateChangeCount
) {
  var messages = {};
  const { times, sources, addresses, datas } = await CanApi.fetchCanPart(
    base,
    num
  );

  for (var i = 0; i < times.length; i++) {
    var t = times[i];
    var src = Int64LE(sources, i * 8).toString(10);
    var address = Int64LE(addresses, i * 8);
    var addressHexStr = address.toString(16);
    var id = src + ":" + addressHexStr;

    var addressNum = address.toNumber();
    var data = datas.slice(i * 8, (i + 1) * 8);
    if (messages[id] === undefined)
      messages[id] = DbcUtils.createMessageSpec(
        dbc,
        address.toNumber(),
        id,
        src
      );

    const prevMsgEntry =
      messages[id].entries.length > 0
github aliyun / aliyun-tablestore-nodejs-sdk / lib / protocol / plain_buffer_stream.js View on Github external
readDoubleAndInt64: function () {
        var buf = this.readRawLittleEndian64();
        var doubleVal = buf.readDoubleLE(0);
        var int64LE = new int64buffer.Int64LE(buf);

        return { doubleVal: doubleVal, int64LE: int64LE };
    },
github aliyun / aliyun-tablestore-nodejs-sdk / lib / protocol / plain_buffer_stream.js View on Github external
readInt64: function () {
        var buf = this.readRawLittleEndian64();
        //https://www.npmjs.com/package/int64-buffer
        var int64LE = new int64buffer.Int64LE(buf);
        return int64LE;
    },
github johnfontaine / LasStreamReader / src / models.js View on Github external
this.compressor = dataView.getUint16(position, true);
  position += 2;
  this.coder = dataView.getUint16(position, true);
  position +=2;
  this.version = {};
  this.version.major = dataView.getUint8(position);
  position += 1;
  this.version.minor = dataView.getUint8(position);
  position += 1;
  this.version.revision = dataView.getUint16(position, true);
  position += 2;
  this.options = dataView.getUint32(position, true);
  position += 4;
  this.chunk_size = dataView.getUint32(position, true);
  position += 4;
  this.number_of_special_evlrs =  new Int64LE(buffer.slice(position, position+8));
  position += 8;
  this.offset_to_special_evlrs =  new Int64LE(buffer.slice(position, position+8));
  position += 8;
  this.num_items = dataView.getUint16(position, true);
  position += 2;
  this.items = [];
  for (let i = 0; i < this.num_items; i++ ) {
      let item = {};
      item.type = dataView.getUint16(dataView, position);
      position +=2;
      item.size = dataView.getUint16(dataView, position);
      position +=2;
      item.version = dataView.getUint16(dataView, position);
      position +=2;
      this.items[i] = item;
  }
github aliyun / aliyun-tablestore-nodejs-sdk / lib / util.js View on Github external
doubleToRawLongBits: function (number) {
      var buf = new Buffer(8);
       buf.fill(0);
       buf.writeDoubleLE(number, 0);

       var int64 = new int64buffer.Int64LE(buf);
       return int64;
    }
  },
github johnfontaine / LasStreamReader / src / models.js View on Github external
this.coder = dataView.getUint16(position, true);
  position +=2;
  this.version = {};
  this.version.major = dataView.getUint8(position);
  position += 1;
  this.version.minor = dataView.getUint8(position);
  position += 1;
  this.version.revision = dataView.getUint16(position, true);
  position += 2;
  this.options = dataView.getUint32(position, true);
  position += 4;
  this.chunk_size = dataView.getUint32(position, true);
  position += 4;
  this.number_of_special_evlrs =  new Int64LE(buffer.slice(position, position+8));
  position += 8;
  this.offset_to_special_evlrs =  new Int64LE(buffer.slice(position, position+8));
  position += 8;
  this.num_items = dataView.getUint16(position, true);
  position += 2;
  this.items = [];
  for (let i = 0; i < this.num_items; i++ ) {
      let item = {};
      item.type = dataView.getUint16(dataView, position);
      position +=2;
      item.size = dataView.getUint16(dataView, position);
      position +=2;
      item.version = dataView.getUint16(dataView, position);
      position +=2;
      this.items[i] = item;
  }
}
github commaai / cabana / src / workers / can-fetcher.js View on Github external
base,
  num,
  canStartTime,
  prevMsgEntries,
  maxByteStateChangeCount
) {
  var messages = {};
  const { times, sources, addresses, datas } = await CanApi.fetchCanPart(
    base,
    num
  );

  for (var i = 0; i < times.length; i++) {
    var t = times[i];
    var src = Int64LE(sources, i * 8).toString(10);
    var address = Int64LE(addresses, i * 8);
    var addressHexStr = address.toString(16);
    var id = src + ":" + addressHexStr;

    var addressNum = address.toNumber();
    var data = datas.slice(i * 8, (i + 1) * 8);
    if (messages[id] === undefined)
      messages[id] = DbcUtils.createMessageSpec(
        dbc,
        address.toNumber(),
        id,
        src
      );

    const prevMsgEntry =
      messages[id].entries.length > 0
        ? messages[id].entries[messages[id].entries.length - 1]
github L-Leite / cso2-master-server / src / packets / in / packet.ts View on Github external
public readInt64(bigEndian: boolean = false): Int64LE | Int64BE {
        if (this.canReadBytes(8) === false) {
            throw new Error('Data buffer is too small')
        }
        const res: Int64LE | Int64BE = bigEndian ?
            new Int64BE(this.packetData, this.curOffset) :
            new Int64LE(this.packetData, this.curOffset)
        this.curOffset += 8
        return res
    }

int64-buffer

64bit Long Integer on Buffer/Array/ArrayBuffer in Pure JavaScript

MIT
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis