sse4_crc32
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"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,9 +32,8 @@ * Calculates CRC in software mode | ||
*/ | ||
var hwCrc32c = isHardwareSupported ? function(input, initialCrc) { | ||
function hwCrc32c(input, initialCrc) { | ||
return Sse4Crc32.hwCrc(input, initialCrc || 0); | ||
} : function() { | ||
throw new Error('Hardware CRC-32C not supported!'); | ||
} | ||
/** | ||
@@ -61,3 +60,3 @@ * Defines a progressive CRC-32C calculator | ||
Crc32C.prototype.update = function(input) { | ||
this.crc32c = calculate(input, this.crc32c); | ||
this.crc32c = module.exports.calculate(input, this.crc32c); | ||
return this; | ||
@@ -77,2 +76,3 @@ }; | ||
/** | ||
@@ -83,3 +83,3 @@ * Export the required functions/classes | ||
module.exports = { | ||
isHardwareCrcSupported: isHardwareSupported, | ||
isHardwareCrcSupported: Sse4Crc32.isHardwareCrcSupported, | ||
calculateInSoftware : swCrc32c, | ||
@@ -89,3 +89,3 @@ calculateOnHardware : hwCrc32c, | ||
CRC32 : Crc32C, | ||
calculate: calculate | ||
calculate: Sse4Crc32.isHardwareCrcSupported() ? hwCrc32c : swCrc32c | ||
}; |
Sorry, the diff of this file is not supported yet
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
25744
250