New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍰 🌮 🍉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?