[CRT] Fix rot functions aliases in non-x86 clang builds

This commit is contained in:
Jérôme Gardou 2021-04-09 14:59:33 +02:00
parent 199adee3fe
commit 620f333252

View file

@ -11,25 +11,27 @@
#include <stdlib.h>
#ifdef __clang__
#define _rotl __function_rotl
#define _rotr __function_rotr
#define _lrotl __function_lrotl
#define _lrotr __function_lrotr
# define _rotl __function_rotl
# define _rotr __function_rotr
# define _lrotl __function_lrotl
# define _lrotr __function_lrotr
#elif defined(_MSC_VER)
#pragma function(_rotr, _rotl, _rotr, _lrotl, _lrotr)
# pragma function(_rotr, _rotl, _rotr, _lrotl, _lrotr)
#endif
#if defined (__clang__) && !defined(_MSC_VER)
#define ASM_ALIAS __asm__
#else
#define ASM_ALIAS(x)
# ifdef _M_IX86
unsigned int _rotr( unsigned int value, int shift ) __asm__("__rotr");
unsigned long _lrotr(unsigned long value, int shift) __asm__("__lrotr");
unsigned int _rotl( unsigned int value, int shift ) __asm__("__rotl");
unsigned long _lrotl( unsigned long value, int shift ) __asm__("__lrotl");
# else
unsigned int _rotr( unsigned int value, int shift ) __asm__("_rotr");
unsigned long _lrotr(unsigned long value, int shift) __asm__("_lrotr");
unsigned int _rotl( unsigned int value, int shift ) __asm__("_rotl");
unsigned long _lrotl( unsigned long value, int shift ) __asm__("_lrotl");
# endif
#endif
unsigned int _rotr( unsigned int value, int shift ) ASM_ALIAS("__rotr");
unsigned long _lrotr(unsigned long value, int shift) ASM_ALIAS("__lrotr");
unsigned int _rotl( unsigned int value, int shift ) ASM_ALIAS("__rotl");
unsigned long _lrotl( unsigned long value, int shift ) ASM_ALIAS("__lrotl");
/*
* @implemented
*/