Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCodechange: math functions - use cpp-style casts #7685
Conversation
This comment has been minimized.
This comment has been minimized.
Of course commit checker fails because |
This comment has been minimized.
This comment has been minimized.
Ah i see, i just found an old conversation about this here: #7407 (comment) I'll make that change. |
This comment has been minimized.
This comment has been minimized.
Please restore the indentation between |
This comment has been minimized.
This comment has been minimized.
Not that I necessarily disagree with the changes, but I'd like to see some justification for them. What problem do they solve? How do they improve things? |
This comment has been minimized.
This comment has been minimized.
Using C++ style casts makes the intention of the code more explicit:
From: https://google.github.io/styleguide/cppguide.html#Casting That said, maybe this should be an all-or-nothing style decision. C++ casts could be used everywhere if that's decided to be an improvement, otherwise just keep everything as it is. |
@@ -383,7 +383,7 @@ static inline T ROR(const T x, const uint8 n) | |||
{ | |||
#if !defined(__ICC) && defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ >= 3)) | |||
/* GCC >= 4.3 provides a builtin, resulting in faster code */ | |||
return (uint32)__builtin_bswap32((int32)x); | |||
return static_cast<uint32>(__builtin_bswap32(static_cast<int32>(x))); |
This comment has been minimized.
This comment has been minimized.
LordAro
Aug 17, 2019
Member
According to https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html, the cast to int32 is unnecessary (or possibly wrong)
Close enough |
nikolas commentedAug 6, 2019
No description provided.