-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Reduce use of pointer arithmetic in TinyPtrSet and BitVector #47334
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
Conversation
EWS run on current version of this PR (hash e18a10b) |
std::span<const uint8_t> byteSpan() const LIFETIME_BOUND { return unsafeMakeSpan(reinterpret_cast<const uint8_t*>(m_words), byteCount(numBits())); } | ||
std::span<uint8_t> byteSpan() LIFETIME_BOUND { return unsafeMakeSpan(reinterpret_cast<uint8_t*>(m_words), byteCount(numBits())); } |
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.
The old code used bit casts and this uses reinterpret casts. Is there a reason to choose one over the other?
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.
The code I removed was using bit_cast whereas the code I'm updating was using reinterpret_cast and still is. I did not purposely change the way of casting. I can probably use std::bit_cast here since we're casting to bytes.
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.
Actually using std::bit_cast
doesn't build here.
https://bugs.webkit.org/show_bug.cgi?id=295141 Reviewed by Darin Adler. Reduce use of pointer arithmetic in TinyPtrSet and BitVector by leveraging flexible array members instead. * Source/WTF/wtf/BitVector.h: * Source/WTF/wtf/TinyPtrSet.h: (WTF::TinyPtrSet::OutOfLineList::list): Canonical link: https://commits.webkit.org/296776@main
e18a10b
to
fbcfad4
Compare
Committed 296776@main (fbcfad4): https://commits.webkit.org/296776@main Reviewed commits have been landed. Closing PR #47334 and removing active labels. |
fbcfad4
e18a10b