]> zoso.dev Git - buffer.git/commitdiff
Fixes to PR #109
authorFeross Aboukhadijeh <feross@feross.org>
Thu, 24 Mar 2016 02:45:03 +0000 (19:45 -0700)
committerFeross Aboukhadijeh <feross@feross.org>
Thu, 24 Mar 2016 02:45:03 +0000 (19:45 -0700)
index.js

index 6f85398192d4941ee13ce2de3f7050101ff2e07a..c939c81d290802a569fe3f451d56756a0e06fc4f 100644 (file)
--- a/index.js
+++ b/index.js
@@ -286,7 +286,11 @@ Buffer.compare = function compare (a, b) {
   var y = b.length
 
   for (var i = 0, len = Math.min(x, y); i < len; ++i) {
-    if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1
+    if (a[i] !== b[i]) {
+      x = a[i]
+      y = b[i]
+      break
+    }
   }
 
   if (x < y) return -1