How to use the long function in long

To help you get started, weā€™ve selected a few long 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 Kagami / wasm-polyfill.js / src / stdlib.js View on Github external
stdlib.i64_from_i32_s = function(v) {
  // Sign-extend into 64 bits.
  if (v & 0x80000000) {
    return new Long(v, -1)
  } else {
    return new Long(v, 0)
  }
}
github Kagami / wasm-polyfill.js / src / translate / input.js View on Github external
shift = 3
    var high = (b & 0x7F) >> 4
    while (b & 0x80) {
      if (shift > 32) {
        throw new CompileError("varuint64 too large")
      }
      b = this.read_byte()
      high = ((b & 0x7F) << shift) | high
      shift += 7
    }
    // Sign-extend into the high bits.
    if (b & 0x40 && shift < 32) {
      high = (-1 << shift) | high
    }
  } 
  return new Long(low, high)
}
github microsoft / vscode-js-debug / src / common / hash.ts View on Github external
new Long(0xc3d2e1f0, 0, true),
  ];
  const randomOdd = [
    new Long(0xb4663807, 0, true),
    new Long(0xcc322bf5, 0, true),
    new Long(0xd4f91bbd, 0, true),
    new Long(0xa7bea11d, 0, true),
    new Long(0x8f462907, 0, true),
  ];

  const hashes = [
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
  ];
  const zi = [
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
  ];
  const k0x7FFFFFFF = new Long(0x7fffffff);

  const buffer = normalize(input);
  const inc = 4;

  // First pass reads 4 bytes at a time
  let current = 0;
  for (let i = 0; i < buffer.byteLength - (buffer.byteLength % inc); i += inc) {
github microsoft / vscode-js-debug / src / common / hash.ts View on Github external
new Long(0x82675bc5, 0, true),
    new Long(0xcd924d35, 0, true),
    new Long(0x81abe279, 0, true),
  ];
  const random = [
    new Long(0x67452301, 0, true),
    new Long(0xefcdab89, 0, true),
    new Long(0x98badcfe, 0, true),
    new Long(0x10325476, 0, true),
    new Long(0xc3d2e1f0, 0, true),
  ];
  const randomOdd = [
    new Long(0xb4663807, 0, true),
    new Long(0xcc322bf5, 0, true),
    new Long(0xd4f91bbd, 0, true),
    new Long(0xa7bea11d, 0, true),
    new Long(0x8f462907, 0, true),
  ];

  const hashes = [
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
  ];
  const zi = [
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
github microsoft / vscode-js-debug / src / common / hash.ts View on Github external
new Long(0xab1f4e4f, 0, true),
    new Long(0x82675bc5, 0, true),
    new Long(0xcd924d35, 0, true),
    new Long(0x81abe279, 0, true),
  ];
  const random = [
    new Long(0x67452301, 0, true),
    new Long(0xefcdab89, 0, true),
    new Long(0x98badcfe, 0, true),
    new Long(0x10325476, 0, true),
    new Long(0xc3d2e1f0, 0, true),
  ];
  const randomOdd = [
    new Long(0xb4663807, 0, true),
    new Long(0xcc322bf5, 0, true),
    new Long(0xd4f91bbd, 0, true),
    new Long(0xa7bea11d, 0, true),
    new Long(0x8f462907, 0, true),
  ];

  const hashes = [
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
  ];
  const zi = [
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
    new Long(1, 0, true),
github Kagami / wasm-polyfill.js / src / stdlib.js View on Github external
function f64_scratchLoad(v) {
  var res = scratchData.getFloat64(0, true)
  if (! isNaNPreserving64 && isNaN(res)) {
    res = new Number(res)
    res._wasmBitPattern = new Long(
      scratchData.getInt32(0, true),
      scratchData.getInt32(4, true)
    )
  }
  return res
}
github Yomguithereal / talisman / src / metrics / distance / eudex.js View on Github external
function bits(number) {
  return new Long((number.toString(2).match(/1/g) || []).length);
}
github cockroachdb / cockroach-gen / pkg / ui / cluster-ui / src / util / appStats / appStats.fixture.ts View on Github external
key: "table",
                              value: "jobs@jobs_status_created_idx",
                            },
                            { key: "spans", value: "5 spans" },
                          ],
                        },
                      ],
                    },
                  ],
                },
              ],
            },
          ],
        },
        most_recent_plan_timestamp: {
          seconds: new Long(1614851545),
          nanos: 886049756,
        },
      },
      bytes_read: { mean: 46.48, squared_diffs: 1296234.24 },
      rows_read: {
        mean: 0.07999999999999999,
        squared_diffs: 3.8399999999999994,
      },
      last_exec_timestamp: {
        seconds: Long.fromInt(1599670282),
        nanos: 111613000,
      },
      nodes: [Long.fromInt(1), Long.fromInt(2)],
      exec_stats: {
        count: new Long(0),
        network_bytes: { mean: 0, squared_diffs: 0 },
github microsoft / vscode-js-debug / src / common / hash.ts View on Github external
export function calculateHash(input: Buffer): string {
  const prime = [
    new Long(0x3fb75161, 0, true),
    new Long(0xab1f4e4f, 0, true),
    new Long(0x82675bc5, 0, true),
    new Long(0xcd924d35, 0, true),
    new Long(0x81abe279, 0, true),
  ];
  const random = [
    new Long(0x67452301, 0, true),
    new Long(0xefcdab89, 0, true),
    new Long(0x98badcfe, 0, true),
    new Long(0x10325476, 0, true),
    new Long(0xc3d2e1f0, 0, true),
  ];
  const randomOdd = [
    new Long(0xb4663807, 0, true),
    new Long(0xcc322bf5, 0, true),
    new Long(0xd4f91bbd, 0, true),
    new Long(0xa7bea11d, 0, true),
    new Long(0x8f462907, 0, true),
  ];

  const hashes = [
    new Long(0, 0, true),
    new Long(0, 0, true),
    new Long(0, 0, true),
github microsoft / vscode-js-debug / src / common / hash.ts View on Github external
export function calculateHash(input: Buffer): string {
  const prime = [
    new Long(0x3fb75161, 0, true),
    new Long(0xab1f4e4f, 0, true),
    new Long(0x82675bc5, 0, true),
    new Long(0xcd924d35, 0, true),
    new Long(0x81abe279, 0, true),
  ];
  const random = [
    new Long(0x67452301, 0, true),
    new Long(0xefcdab89, 0, true),
    new Long(0x98badcfe, 0, true),
    new Long(0x10325476, 0, true),
    new Long(0xc3d2e1f0, 0, true),
  ];
  const randomOdd = [
    new Long(0xb4663807, 0, true),
    new Long(0xcc322bf5, 0, true),
    new Long(0xd4f91bbd, 0, true),
    new Long(0xa7bea11d, 0, true),