mirror of
https://github.com/reactos/reactos.git
synced 2025-01-07 14:51:00 +00:00
[CRT]
- add clang compatible asm version of ldexp and make the code more readable - constify strndup parameter to match standard - fix broken pointer comparison in signal() svn path=/trunk/; revision=47479
This commit is contained in:
parent
1db109e182
commit
f0c2cec9d5
3 changed files with 22 additions and 14 deletions
|
@ -21,24 +21,32 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
double ldexp (double __x, int __y);
|
||||
|
||||
double ldexp (double __x, int __y)
|
||||
double ldexp (double value, int exp)
|
||||
{
|
||||
register double __val;
|
||||
register double result;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fscale"
|
||||
: "=t" (__val) : "0" (__x), "u" ((double) __y));
|
||||
#if defined(__clang__)
|
||||
asm ("fild %[exp]\n"
|
||||
"fscale\n"
|
||||
"fstp %%st(1)\n"
|
||||
: [result] "=t" (result)
|
||||
: [value] "0" (value), [exp] "m" (exp));
|
||||
#else
|
||||
register double __dy = (double)__y;
|
||||
asm ("fscale"
|
||||
: "=t" (result)
|
||||
: "0" (value), "u" ((double)exp)
|
||||
: "1");
|
||||
#endif
|
||||
#else /* !__GNUC__ */
|
||||
register double __dy = (double)exp;
|
||||
__asm
|
||||
{
|
||||
fld __dy
|
||||
fld __x
|
||||
fld value
|
||||
fscale
|
||||
fstp __val
|
||||
fstp result
|
||||
}
|
||||
#endif /*__GNUC__*/
|
||||
return __val;
|
||||
#endif /* !__GNUC__ */
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ int __argc = 0;
|
|||
|
||||
extern wchar_t **__winitenv;
|
||||
|
||||
char* strndup(char* name, size_t len)
|
||||
char* strndup(char const* name, size_t len)
|
||||
{
|
||||
char *s = malloc(len + 1);
|
||||
if (s != NULL)
|
||||
|
|
|
@ -42,7 +42,7 @@ __p_sig_fn_t signal(int sig, __p_sig_fn_t func)
|
|||
}
|
||||
|
||||
// check with IsBadCodePtr
|
||||
if ( func < (__p_sig_fn_t)4096 && func != SIG_DFL && func != SIG_IGN)
|
||||
if ( (uintptr_t)func < 4096 && func != SIG_DFL && func != SIG_IGN)
|
||||
{
|
||||
__set_errno(EINVAL);
|
||||
return SIG_ERR;
|
||||
|
|
Loading…
Reference in a new issue