[Pkg-javascript-commits] [node-sha.js] 200/237: hexpp: adhere to stnadard

Bastien Roucariès rouca at moszumanska.debian.org
Fri May 5 09:04:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-sha.js.

commit 2aa27074799df136b6b49cd0cdb272fe39c742a9
Author: Daniel Cousens <github at dcousens.com>
Date:   Sat May 30 13:28:36 2015 +1000

    hexpp: adhere to stnadard
---
 hexpp.js | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/hexpp.js b/hexpp.js
index f6e52f3..4f1e921 100644
--- a/hexpp.js
+++ b/hexpp.js
@@ -1,29 +1,18 @@
-
-
 function toHex (buf, group, wrap, LE) {
   buf = buf.buffer || buf
   var s = ''
   var l = buf.byteLength || buf.length
-  for(var i = 0; i < l ; i++) {
-    var byte = (i&0xfffffffc)|(!LE ? i%4 : 3 - i%4)
-    s = s + ((buf[byte]>>4).toString(16))
-          + ((buf[byte]&0xf).toString(16))
-          + (group-1==i%group ? ' ' : '')
-          + (wrap-1==i%wrap ? '\n' : '')
+  for (var i = 0; i < l ; i++) {
+    var byteParam = (i & 0xfffffffc) | (!LE ? i % 4 : 3 - i % 4)
+    s += ((buf[byteParam] >> 4).toString(16)) +
+         ((buf[byteParam] & 0xf).toString(16)) +
+         (group - 1 === i % group ? ' ' : '') +
+         (wrap - 1 === i % wrap ? '\n' : '')
   }
   return s
 }
 
-function reverseByteOrder(n) {
-  return (
-    ((n << 24) & 0xff000000)
-  | ((n <<  8) & 0x00ff0000)
-  | ((n >>  8) & 0x0000ff00)
-  | ((n >> 24) & 0x000000ff)
-  )
-}
-
-var hexpp = module.exports = function (buffer, opts) {
+var hexpp = module.exports = function hexpp (buffer, opts) {
   opts = opts || {}
   opts.groups = opts.groups || 4
   opts.wrap = opts.wrap || 16
@@ -35,4 +24,3 @@ hexpp.defaults = function (opts) {
     return hexpp(b, opts)
   }
 }
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-sha.js.git



More information about the Pkg-javascript-commits mailing list