1.fix error on build msgpack with UE4#779
1.fix error on build msgpack with UE4#779redboltz merged 2 commits intomsgpack:masterfrom RPG3D:master
Conversation
include/msgpack/sysdep.h
Outdated
| # define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr) | ||
| # define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr) | ||
| # define _msgpack_sync_decr_and_fetch(ptr) _InterlockedDecrement(ptr) | ||
| # define _msgpack_sync_incr_and_fetch(ptr) _InterlockedIncrement(ptr) |
There was a problem hiding this comment.
What is the difference between InterlockedDecrement and _InterlockedDecrement ?
It seems that both function exists.
I don't know much about Windows APIs. I'd like to know _InterlockedDecrement is always better choice than InterlockedDecrement.
There was a problem hiding this comment.
What is the difference between InterlockedDecrement and _InterlockedDecrement ?
It seems that both function exists.
I don't know much about Windows APIs. I'd like to know _InterlockedDecrement is always better choice than InterlockedDecrement.
https://docs.microsoft.com/en-us/previous-versions/ms919120(v=msdn.10)
https://docs.microsoft.com/en-us/cpp/intrinsics/interlockeddecrement-intrinsic-functions?view=vs-2019
seamed InterlockedDecrement is for Windows CE
There was a problem hiding this comment.
Thank you. It seems that the code should be as follows:
#if WINCE /* Some how get WinCE or Not */
# define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
# define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)
#else /* WINCE */
# define _msgpack_sync_decr_and_fetch(ptr) _InterlockedDecrement(ptr)
# define _msgpack_sync_incr_and_fetch(ptr) _InterlockedIncrement(ptr)
#endif /* WINCE */There was a problem hiding this comment.
InterlockedDecrement and its friends are Win32 API so it is available on any Desktop Windows and UWP as well: https://docs.microsoft.com/en-us/windows/desktop/api/winnt/nf-winnt-interlockeddecrement it IS available Windows other than WinCE, but NOT x64.
_InterlockedDecrement and its friends are compiler intrinsic, which is always available on modern Windows platforms(x86, x64 and ARM32). So I guess it is okay to just ignore WinCE here as it is almost being obsolete.
In case we need some completeness here, check against x64 (and ARM) then use _InterlockedDecrement only on there.
There was a problem hiding this comment.
@RPG3D, it looks good to me. Thank you for updating!
No description provided.