[libcxx-commits] [PATCH] D98207: [SystemZ][z/OS] Missing wchar functions libc++
Muiez Ahmed via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Sep 2 14:26:26 PDT 2021
muiez marked 5 inline comments as done.
muiez added inline comments.
================
Comment at: libcxx/src/support/ibm/mbsnrtowcs.cpp:50
+ source_converted += char_size;
+ ++dest_converted;
+ continue;
----------------
DanielMcIntosh-IBM wrote:
> Probably easier to increment `dst` directly here. You'll have to do so behind an extra `if (dst)`, but in exchange you can get rid of the ternary operator on line 45, and get rid of a state variable.
I'd prefer to not add an extra conditional within the loop due to a performance tradeoff. Also, as mentioned below, `dest_converted` is returned so we need that state variable either way.
================
Comment at: libcxx/src/support/ibm/mbsnrtowcs.cpp:58
+ if (dst) {
+ if (have_result && result == terminated_sequence)
+ *src = NULL;
----------------
DanielMcIntosh-IBM wrote:
> I think that we may be able to get rid of `have_result` here too, but I'm not as sure about this one, since `result` is initialized to 0, and `terminated_sequence == static_cast<size_t>(0)`.
Yup, by using `result` directly within the loop (since it gets updated), I was able to remove `have_result`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98207/new/
https://reviews.llvm.org/D98207
More information about the libcxx-commits
mailing list