-
Notifications
You must be signed in to change notification settings - Fork 283
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
provide ssz bitvector OR function #8302
Conversation
Co-authored-by: mehdi-aouadi <mehdi.aouadi@consensys.net>
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.
LGTM just nit finals
...e/ssz/src/main/java/tech/pegasys/teku/infrastructure/ssz/collections/impl/BitvectorImpl.java
Outdated
Show resolved
Hide resolved
...sz/src/main/java/tech/pegasys/teku/infrastructure/ssz/collections/impl/SszBitvectorImpl.java
Outdated
Show resolved
Hide resolved
@@ -76,6 +76,16 @@ public List<Integer> getSetBitIndices() { | |||
return data.stream().boxed().toList(); | |||
} | |||
|
|||
public BitvectorImpl or(final BitvectorImpl other) { | |||
if (other.getSize() > getSize()) { |
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.
i'd think we want to make sure the sizes match exactly if we're doing a bitwise or, otherwise we'll be needing to decide if the stragglers are left or right etc... other.size() != getSize
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.
mm yes but this mimics the BitlistImpl
or which does the same. We may say that this is a vector so it could be more strict but I'm more on the side to have a similar behavior.
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.
its probably bad behaviour to mimic... you can mis-match and do bitwise or partially.... future @tbenr problem to find i guess...
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.
Is this feature really used somewhere? (I mean or with smaller list/vector)
If yes we could split it to several safer steps, but it could affect performance
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.
k lets be more stringent and maybe open in the future.
@zilm13 we won't (at least for 7549)
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.
i really do think we're better off making this one right rather than copying a bad idea - especially on a bitwise or... at least then we know why its a greater than if it causes a break...
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.
other than the discussion about sizings, looks good. won't block it but i do feel like we should check it fully on a bitwise op.
provides bitvecor OR, useful for 7549
Related to #7965
Documentation
doc-change-required
label to this PR if updates are required.Changelog