Is there a bug in bit_array's sub function?#2506
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2506 +/- ##
==========================================
+ Coverage 61.35% 61.4% +0.05%
==========================================
Files 197 197
Lines 16453 16496 +43
==========================================
+ Hits 10094 10129 +35
- Misses 5504 5514 +10
+ Partials 855 853 -2
|
ValarDragon
left a comment
There was a problem hiding this comment.
Great catch! The reason this didn't fail before is because our tests never covered this case. I think this function and the associated tests are far too complex, and should be radically simplified in another PR though.
|
I'm sorry but I found in the CHANGELOG_PENDING.md . The contributor' name is wrong.
It's not me. Would you please kindly modify it to me? Many thanks. |
|
Oops, thank you for telling us! Fixed. |
|
I'm really sorry. But would you please modify this line for me too? |
|
We actually handle that line when building the release! So don't worry, we'll get it :) (Theres several more people missing from that atm) |
This is original code:
if bA.Bits > o.Bits {
c := bA.copy()
for i := 0; i < len(o.Elems)-1; i++ {
c.Elems[i] &= ^c.Elems[i]
}
i := len(o.Elems) - 1
if i >= 0 {
for idx := i * 64; idx < o.Bits; idx++ {
c.setIndex(idx, c.getIndex(idx) && !o.getIndex(idx))
}
}
return c
}
this part,
c := bA.copy()
for i := 0; i < len(o.Elems)-1; i++ {
c.Elems[i] &= ^c.Elems[i]
}
I don't understand, is it wrong?