-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,896 additions
and
1,210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- "5" | ||
- "4" | ||
- "0.12" | ||
- "0.11" | ||
- "0.10" | ||
- "12" | ||
- "10" | ||
after_success: yarn run coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
var sse4_crc32 = require('sse4_crc32'); | ||
|
||
module.exports = { | ||
calculate: sse4_crc32.calculate | ||
calculate: sse4_crc32.calculate, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
var fs = require('fs'); | ||
|
||
module.exports = (function(loaders) { | ||
|
||
var impls = [ | ||
'./impls/sse4_crc32c_hw', | ||
'./impls/sse4_crc32c_sw', | ||
'./impls/js_crc32c' | ||
const impls = [ | ||
'./impls/sse4_crc32c', | ||
'./impls/js_crc32c', | ||
]; | ||
|
||
for (var i = 0; i < impls.length; i++) { | ||
try { | ||
var crc32 = require(impls[i]); | ||
if (crc32.calculate("The quick brown fox jumps over the lazy dog") == 0x22620404) | ||
return crc32; | ||
} catch(e) { | ||
module.exports = (() => { | ||
for (const impl of impls) { | ||
try { | ||
const crc32 = require(impl); | ||
if (crc32.calculate('The quick brown fox jumps over the lazy dog') === 0x22620404) { | ||
return crc32; | ||
} | ||
} catch(e) { | ||
// ignore the error and try next implementation. | ||
} | ||
} | ||
} | ||
|
||
throw new Error('Failed to find available CRC-32C implementation.'); | ||
|
||
return { | ||
calculate() { | ||
throw new Error('no CRC-32C implementation is available'); | ||
}, | ||
}; | ||
})(); |
Oops, something went wrong.