Skip to content

Commit

Permalink
Try optimization: only add required shards errorBits/errLocs
Browse files Browse the repository at this point in the history
  • Loading branch information
liamsi committed Mar 4, 2024
1 parent 0b4e3cb commit 7a3b1b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions leopard.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,19 +430,19 @@ func (r *leopardFF16) reconstruct(shards [][]byte, recoverAll bool, required []b
for i := 0; i < r.parityShards; i++ {
if len(shards[i+r.dataShards]) == 0 {
errLocs[i] = 1
if LEO_ERROR_BITFIELD_OPT && recoverAll {
if LEO_ERROR_BITFIELD_OPT && (recoverAll || required[i]) {
errorBits.set(i)
}
}
}
for i := r.parityShards; i < m; i++ {
errLocs[i] = 1
if LEO_ERROR_BITFIELD_OPT && recoverAll {
if LEO_ERROR_BITFIELD_OPT && (recoverAll || required[i]) {
errorBits.set(i)
}
}
for i := 0; i < r.dataShards; i++ {
if len(shards[i]) == 0 {
if len(shards[i]) == 0 && (recoverAll || required[i]) {
errLocs[i+m] = 1
if LEO_ERROR_BITFIELD_OPT {
errorBits.set(i + m)
Expand Down
6 changes: 3 additions & 3 deletions leopard8.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,19 @@ func (r *leopardFF8) reconstruct(shards [][]byte, recoverAll bool, required []bo
for i := 0; i < r.parityShards; i++ {
if len(shards[i+r.dataShards]) == 0 {
errLocs[i] = 1
if LEO_ERROR_BITFIELD_OPT && recoverAll {
if LEO_ERROR_BITFIELD_OPT && (recoverAll || required[i]) {
errorBits.set(i)
}
}
}
for i := r.parityShards; i < m; i++ {
errLocs[i] = 1
if LEO_ERROR_BITFIELD_OPT && recoverAll {
if LEO_ERROR_BITFIELD_OPT && (recoverAll || required[i]) {
errorBits.set(i)
}
}
for i := 0; i < r.dataShards; i++ {
if len(shards[i]) == 0 {
if len(shards[i]) == 0 && (recoverAll || required[i]) {
errLocs[i+m] = 1
if LEO_ERROR_BITFIELD_OPT {
errorBits.set(i + m)
Expand Down

0 comments on commit 7a3b1b5

Please sign in to comment.