Conversation
copy from lexxmark/winflexbison@2a7586a by @yjh-styx - partial work on westes#367
|
I think this missed a check that MSVC compiles code only for little-endian machines. Otherwise the semantic would be wrong. |
|
Update: I think it would be good enough to cite this in the code comments |
|
So you suggest to make those macros a no-op, right? |
|
@GitMensch No. The byte order does need to be swapped for little endian. What I meant is add a comment that MSVC only supports little endian platforms and you have the macros defined the way you did them. #ifdef _MSC_VER
/* MSVC only supports little endian.
(https://learn.microsoft.com/en-us/cpp/standard-library/bit-enum?view=msvc-170) */
#include <stdlib.h>
#define htonl(n) _byteswap_ulong(n)
#define htons(n) _byteswap_ushort(n)
#endif |
|
I see, thanks for the clarification. |
|
@Explorer09 you can use GitHub's code suggestion feature, then @GitMensch can apply the changes with a few clicks and you get credits :) |
I was expecting that @GitMensch adjust the formatting of my suggested change instead of applying the changes as is. |
|
If someone wants to implement @xplorer09's suggestion (with whatever else MS stuff needs to be done inside the ifdef), I would merge it. |
copy from lexxmark/winflexbison@2a7586a by @yjh-styx - partial work on #367