Same logic, but much easier to read this way
Details
- Reviewers
ldionne curdeius mclow.lists Mordante - Group Reviewers
Restricted Project - Commits
- rG41481b7db5c7: [libcxx][NFC] tidy up money_get::__do_get's sign parsing
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks, this indeed looks better readable!
LGTM, but I prefer to remove the unneeded assignment.
libcxx/include/locale | ||
---|---|---|
2898 | The original algorithm never sets __neg to false. Looking at the code it seems the call-site always sets this value to false. |
libcxx/include/locale | ||
---|---|---|
2898 | True, however, as you mentioned, the call-site always sets the value to false, so this isn't actually a functional change. I'm open to other ideas, but explicitly setting __neg to false when we detect a positive seems more illustrative to me, and generally safer. Additionally, explicitly setting it to false here means that the only case where we _don't_ set __neg is when __psn.size() == 0 && __nsn.size() == 0 - i.e. when the locale has no means of specifying a positive or negative value. This lets us use the initial value of __neg as a default value for that case. |
The original algorithm never sets __neg to false. Looking at the code it seems the call-site always sets this value to false.