Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
c00 = a00 * b00
c16 = c00 >>> 16
c16 += a16 * b00
c16 &= 0xFFFF // Not required but improves performance
c16 += a00 * b16
this._low = c00 & 0xFFFF
this._high = c16 & 0xFFFF
}
/*
* Constants
*/
var PRIME32_1 = UINT32( '2654435761' )
var PRIME32_2 = UINT32( '2246822519' )
var PRIME32_3 = UINT32( '3266489917' )
var PRIME32_4 = UINT32( '668265263' )
var PRIME32_5 = UINT32( '374761393' )
/**
* Convert string to proper UTF-8 array
* @param str Input string
* @returns {Uint8Array} UTF8 array is returned as uint8 array
*/
function toUTF8Array (str) {
var utf8 = []
for (var i=0, n=str.length; i < n; i++) {
var charcode = str.charCodeAt(i)
if (charcode < 0x80) utf8.push(charcode)
else if (charcode < 0x800) {
c00 = a00 * b00
c16 = c00 >>> 16
c16 += a16 * b00
c16 &= 0xFFFF // Not required but improves performance
c16 += a00 * b16
this._low = c00 & 0xFFFF
this._high = c16 & 0xFFFF
}
/*
* Constants
*/
var PRIME32_1 = UINT32( '2654435761' )
var PRIME32_2 = UINT32( '2246822519' )
var PRIME32_3 = UINT32( '3266489917' )
var PRIME32_4 = UINT32( '668265263' )
var PRIME32_5 = UINT32( '374761393' )
/**
* Convert string to proper UTF-8 array
* @param str Input string
* @returns {Uint8Array} UTF8 array is returned as uint8 array
*/
function toUTF8Array (str) {
var utf8 = []
for (var i=0, n=str.length; i < n; i++) {
var charcode = str.charCodeAt(i)
if (charcode < 0x80) utf8.push(charcode)
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
c16 += a16 * b00
c16 &= 0xFFFF // Not required but improves performance
c16 += a00 * b16
this._low = c00 & 0xFFFF
this._high = c16 & 0xFFFF
}
/*
* Constants
*/
var PRIME32_1 = UINT32( '2654435761' )
var PRIME32_2 = UINT32( '2246822519' )
var PRIME32_3 = UINT32( '3266489917' )
var PRIME32_4 = UINT32( '668265263' )
var PRIME32_5 = UINT32( '374761393' )
/**
* Convert string to proper UTF-8 array
* @param str Input string
* @returns {Uint8Array} UTF8 array is returned as uint8 array
*/
function toUTF8Array (str) {
var utf8 = []
for (var i=0, n=str.length; i < n; i++) {
var charcode = str.charCodeAt(i)
if (charcode < 0x80) utf8.push(charcode)
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
0x80 | (charcode & 0x3f))
}
else if (charcode < 0xd800 || charcode >= 0xe000) {
function compressBlock (src, dst, pos, hashTable, sIdx, eIdx) {
var Hash = uint32() // Reusable unsigned 32 bits integer
var dpos = sIdx
var dlen = eIdx - sIdx
var anchor = 0
if (src.length >= maxInputSize) throw new Error("input too large")
// Minimum of input bytes for compression (LZ4 specs)
if (src.length > mfLimit) {
var n = exports.compressBound(src.length)
if ( dlen < n ) throw Error("output too small: " + dlen + " < " + n)
var
step = 1
, findMatchAttempts = (1 << skipStrength) + 3
// Keep last few bytes incompressible (LZ4 specs):
// last 5 bytes must be literals
// uint32() optimization
, hashLog = 16
, hashShift = (minMatch * 8) - hashLog
, hashSize = 1 << hashLog
, copyLength = 8
, lastLiterals = 5
, mfLimit = copyLength + minMatch
, skipStrength = 6
, mlBits = 4
, mlMask = (1 << mlBits) - 1
, runBits = 8 - mlBits
, runMask = (1 << runBits) - 1
, hasher = uint32(2654435761)
// CompressBound returns the maximum length of a lz4 block, given it's uncompressed length
exports.compressBound = function (isize) {
return isize > maxInputSize
? 0
: (isize + (isize/255) + 16) | 0
}
exports.compressHC = exports.compress
exports.compress = function (src, dst, sIdx, eIdx) {
// V8 optimization: non sparse array with integers
var hashTable = new Array(hashSize)
for (var i = 0; i < hashSize; i++) {
hashTable[i] = 0
}
c00 = a00 * b00
c16 = c00 >>> 16
c16 += a16 * b00
c16 &= 0xFFFF // Not required but improves performance
c16 += a00 * b16
this._low = c00 & 0xFFFF
this._high = c16 & 0xFFFF
}
/*
* Constants
*/
var PRIME32_1 = UINT32( '2654435761' )
var PRIME32_2 = UINT32( '2246822519' )
var PRIME32_3 = UINT32( '3266489917' )
var PRIME32_4 = UINT32( '668265263' )
var PRIME32_5 = UINT32( '374761393' )
var PRIME32_1plus2 = PRIME32_1.clone().add(PRIME32_2)
/**
* Convert string to proper UTF-8 array
* @param str Input string
* @returns {Uint8Array} UTF8 array is returned as uint8 array
*/
function toUTF8Array (str) {
var utf8 = []
for (var i=0, n=str.length; i < n; i++) {
var charcode = str.charCodeAt(i)
if (charcode < 0x80) utf8.push(charcode)
c00 = a00 * b00
c16 = c00 >>> 16
c16 += a16 * b00
c16 &= 0xFFFF // Not required but improves performance
c16 += a00 * b16
this._low = c00 & 0xFFFF
this._high = c16 & 0xFFFF
}
/*
* Constants
*/
var PRIME32_1 = UINT32( '2654435761' )
var PRIME32_2 = UINT32( '2246822519' )
var PRIME32_3 = UINT32( '3266489917' )
var PRIME32_4 = UINT32( '668265263' )
var PRIME32_5 = UINT32( '374761393' )
var PRIME32_1plus2 = PRIME32_1.clone().add(PRIME32_2)
/**
* Convert string to proper UTF-8 array
* @param str Input string
* @returns {Uint8Array} UTF8 array is returned as uint8 array
*/
function toUTF8Array (str) {
var utf8 = []
for (var i=0, n=str.length; i < n; i++) {
var charcode = str.charCodeAt(i)
XXH.prototype.digest = function () {
var input = this.memory
var p = 0
var bEnd = this.memsize
var h32, h
var u = new UINT32
if (this.total_len >= 16)
{
h32 = this.v1.rotl(1).add( this.v2.rotl(7).add( this.v3.rotl(12).add( this.v4.rotl(18) ) ) )
}
else
{
h32 = this.seed.clone().add( PRIME32_5 )
}
h32.add( u.fromNumber(this.total_len) )
while (p <= bEnd - 4)
{
u.fromBits(
(input[p+1] << 8) | input[p]
function init (seed) {
this.seed = seed instanceof UINT32 ? seed.clone() : UINT32(seed)
this.v1 = this.seed.clone().add(PRIME32_1plus2)
this.v2 = this.seed.clone().add(PRIME32_2)
this.v3 = this.seed.clone()
this.v4 = this.seed.clone().subtract(PRIME32_1)
this.total_len = 0
this.memsize = 0
this.memory = null
return this
}
XXH.prototype.init = init
XXH.prototype.digest = function () {
var input = this.memory
var isString = typeof input == 'string'
var p = 0
var bEnd = this.memsize
var h32, h
var u = new UINT32
if (this.total_len >= 16)
{
h32 = this.v1.rotl(1).add( this.v2.rotl(7).add( this.v3.rotl(12).add( this.v4.rotl(18) ) ) )
}
else
{
h32 = this.seed.add( PRIME32_5 )
}
h32.add( u.fromNumber(this.total_len) )
while (p <= bEnd - 4)
{
if (isString) {
u.fromBits(