Author: tkreuzer
Date: Mon May 31 03:50:09 2010
New Revision: 47479
URL:
http://svn.reactos.org/svn/reactos?rev=47479&view=rev
Log:
[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()
Modified:
trunk/reactos/lib/sdk/crt/math/i386/ldexp.c
trunk/reactos/lib/sdk/crt/misc/getargs.c
trunk/reactos/lib/sdk/crt/signal/signal.c
Modified: trunk/reactos/lib/sdk/crt/math/i386/ldexp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/ldex…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/i386/ldexp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/i386/ldexp.c [iso-8859-1] Mon May 31 03:50:09 2010
@@ -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;
}
+
Modified: trunk/reactos/lib/sdk/crt/misc/getargs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/misc/getargs.c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/misc/getargs.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/misc/getargs.c [iso-8859-1] Mon May 31 03:50:09 2010
@@ -22,7 +22,7 @@
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)
Modified: trunk/reactos/lib/sdk/crt/signal/signal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/signal/signal.…
==============================================================================
--- trunk/reactos/lib/sdk/crt/signal/signal.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/signal/signal.c [iso-8859-1] Mon May 31 03:50:09 2010
@@ -42,7 +42,7 @@
}
// 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;