From 0b630aea2793158b43d0e18f2f50280bfb27c4b4 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 29 Apr 2016 14:00:48 -0700 Subject: [PATCH] use bytes.Equal rather than bytes.Compare --- matrix.go | 5 +---- reedsolomon.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/matrix.go b/matrix.go index e4b3748..1a59bc1 100644 --- a/matrix.go +++ b/matrix.go @@ -178,10 +178,7 @@ func (m matrix) SwapRows(r1, r2 int) error { // IsSquare will return true if the matrix is square // and nil if the matrix is square func (m matrix) IsSquare() bool { - if len(m) != len(m[0]) { - return false - } - return true + return len(m) == len(m[0]) } // errSingular is returned if the matrix is singular and cannot be inversed diff --git a/reedsolomon.go b/reedsolomon.go index 4b95c93..3fe91f1 100644 --- a/reedsolomon.go +++ b/reedsolomon.go @@ -280,7 +280,7 @@ func (r reedSolomon) checkSomeShards(matrixRows, inputs, toCheck [][]byte, outpu } for i, calc := range outputs { - if bytes.Compare(calc, toCheck[i][start:start+do]) != 0 { + if !bytes.Equal(calc, toCheck[i][start:start+do]) { mu.Lock() same = false mu.Unlock()