sse4_crc32
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"author": "Anand Suresh <anandsuresh@gmail.com> (https://github.com/anandsuresh)", | ||
@@ -16,0 +16,0 @@ "license":"MIT", |
@@ -9,5 +9,5 @@ /** | ||
var Sse4Crc32 = require("bindings")("sse4_crc32"); | ||
var isHardwareSupported = Sse4Crc32.isHardWareCrcSupported; | ||
var calculate = isHardwareSupported ? hwCrc32c : swCrc32c; | ||
/** | ||
@@ -32,6 +32,6 @@ * Calculates CRC in software mode | ||
*/ | ||
function hwCrc32c(input, initialCrc) { | ||
if (!Sse4Crc32.isHardwareCrcSupported) throw new Error('Hardware CRC-32C not supported!'); | ||
var hwCrc32c = isHardwareSupported ? function(input, initialCrc) { | ||
return Sse4Crc32.hwCrc(input, initialCrc || 0); | ||
} : function() { | ||
throw new Error('Hardware CRC-32C not supported!'); | ||
} | ||
@@ -41,19 +41,2 @@ | ||
/** | ||
* Used to calculate 32-bit CRC for single instances of strings and/or buffers | ||
* | ||
* This function automatically determines the best mode of operation (h/w vs. s/w implementation). | ||
* | ||
* @param {String|Buffer} input The input string for which the CRC is to be calculated | ||
* @param {Number} [initialCrc=0] An optional initial CRC | ||
* @returns {Number} | ||
*/ | ||
function calculate(input, initialCrc) { | ||
var crcFunction = Sse4Crc32.isHardwareCrcSupported ? Sse4Crc32.hwCrc : Sse4Crc32.swCrc; | ||
return crcFunction(input, initialCrc || 0); | ||
} | ||
/** | ||
* Defines a progressive CRC-32C calculator | ||
@@ -99,3 +82,3 @@ * | ||
module.exports = { | ||
isHardwareCrcSupported: Sse4Crc32.isHardwareCrcSupported, | ||
isHardwareCrcSupported: isHardwareSupported, | ||
calculateInSoftware : swCrc32c, | ||
@@ -102,0 +85,0 @@ calculateOnHardware : hwCrc32c, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
25931
254