@chainsafe/snappy-stream
Advanced tools
+12
-5
@@ -5,8 +5,15 @@ var crc32c = require('fast-crc32c').calculate | ||
| module.exports = function (value) { | ||
| var x = crc32c(value) | ||
| var result = bufferAlloc(4) | ||
| var x = crc32c(value) | ||
| var result = bufferAlloc(4) | ||
| result.writeUInt32LE(((((x >> 15) | (x << 17)) + 0xa282ead8)) >>> 0, 0, true) | ||
| // As defined in section 3 of https://github.com/google/snappy/blob/master/framing_format.txt | ||
| // And other implementations for reference: | ||
| // Go: https://github.com/golang/snappy/blob/2e65f85255dbc3072edf28d6b5b8efc472979f5a/snappy.go#L97 | ||
| // Python: https://github.com/andrix/python-snappy/blob/602e9c10d743f71bef0bac5e4c4dffa17340d7b3/snappy/snappy.py#L70 | ||
| // Mask the right hand to (32 - 17) = 15 bits -> 0x7fff, to keep correct 32 bit values. | ||
| // Shift the left hand with >>> for correct 32 bit intermediate result. | ||
| // Then final >>> 0 for 32 bits output | ||
| result.writeUInt32LE(((((x >>> 15) | ((x & 0x7fff) << 17)) + 0xa282ead8)) >>> 0, 0, true) | ||
| return result | ||
| } | ||
| return result | ||
| } |
+1
-1
| { | ||
| "name": "@chainsafe/snappy-stream", | ||
| "version": "3.0.3", | ||
| "version": "3.0.4", | ||
| "description": "Compress data over a Stream using the snappy framing format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project version="4"> | ||
| <component name="JavaScriptSettings"> | ||
| <option name="languageLevel" value="ES6" /> | ||
| </component> | ||
| </project> |
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project version="4"> | ||
| <component name="ProjectModuleManager"> | ||
| <modules> | ||
| <module fileurl="file://$PROJECT_DIR$/.idea/node-snappy-stream.iml" filepath="$PROJECT_DIR$/.idea/node-snappy-stream.iml" /> | ||
| </modules> | ||
| </component> | ||
| </project> |
Sorry, the diff of this file is not supported yet
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project version="4"> | ||
| <component name="VcsDirectoryMappings"> | ||
| <mapping directory="$PROJECT_DIR$" vcs="Git" /> | ||
| </component> | ||
| </project> |
Sorry, the diff of this file is not supported yet
521
1.36%39606
-1.95%14
-22.22%