Skip to content

Commit 1d57ac0

Browse files
committed
Slice len is always non-negative
1 parent e586036 commit 1d57ac0

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

leopard.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ func (r *leopardFF16) Split(data []byte) ([][]byte, error) {
303303
// Copy partial shards
304304
copyFrom := data[perShard*fullShards : dataLen]
305305
for i := range padding {
306-
if len(copyFrom) <= 0 {
306+
if len(copyFrom) == 0 {
307307
break
308308
}
309309
copyFrom = copyFrom[copy(padding[i], copyFrom):]

leopard8.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func (r *leopardFF8) Split(data []byte) ([][]byte, error) {
344344
// Copy partial shards
345345
copyFrom := data[perShard*fullShards : dataLen]
346346
for i := range padding {
347-
if len(copyFrom) <= 0 {
347+
if len(copyFrom) == 0 {
348348
break
349349
}
350350
copyFrom = copyFrom[copy(padding[i], copyFrom):]

matrix.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ var errColSizeMismatch = errors.New("column size is not the same for all rows")
6767

6868
func (m matrix) Check() error {
6969
rows := len(m)
70-
if rows <= 0 {
70+
if rows == 0 {
7171
return errInvalidRowSize
7272
}
7373
cols := len(m[0])
74-
if cols <= 0 {
74+
if cols == 0 {
7575
return errInvalidColSize
7676
}
7777

reedsolomon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ func (r *reedSolomon) Split(data []byte) ([][]byte, error) {
16331633
// Copy partial shards
16341634
copyFrom := data[perShard*fullShards : dataLen]
16351635
for i := range padding {
1636-
if len(copyFrom) <= 0 {
1636+
if len(copyFrom) == 0 {
16371637
break
16381638
}
16391639
copyFrom = copyFrom[copy(padding[i], copyFrom):]

0 commit comments

Comments
 (0)