You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/07/30 16:13:06 UTC
[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #848: MINIFICPP-1268 Fix compiler warnings on Windows (VS2017)
fgerlits commented on a change in pull request #848:
URL: https://github.com/apache/nifi-minifi-cpp/pull/848#discussion_r463111602
##########
File path: libminifi/include/io/Serializable.h
##########
@@ -44,8 +44,9 @@ Integral byteSwap(Integral i) {
#ifdef htonll
return htonll(i);
#else
- #define htonll_r(x) ((((uint64_t)htonl(x)) << 32) + htonl((x) >> 32))
- return htonll_r(i);
+ uint32_t lower_32_bits = static_cast<uint32_t>(i);
Review comment:
The new code is equivalent to the old code which used the `#define`, but you are right that it's not always equivalent to `htonll`. We check `is_little_endian` every time before we call `byteSwap`; it might be better to move that check inside `byteSwap`, but I didn't think that was in scope for this change.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org