1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* missing/signbit.c: added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-03-11 03:14:21 +00:00
parent 9c0119c4bd
commit 5b8af7521f
3 changed files with 25 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Thu Mar 11 12:14:17 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* missing/signbit.c: added.
Thu Mar 11 11:16:33 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in: check if target_archs has changed.

View file

@ -1114,7 +1114,7 @@ AS_CASE([$rb_cv_broken_glibc_ia64_erfc],[yes],[ac_cv_func_erf=no])
AS_CASE(["$target_os"],[mingw*],[],[AC_REPLACE_FUNCS(vsnprintf)])
AC_REPLACE_FUNCS(dup2 memmove strerror\
strchr strstr crypt flock\
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt \
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt signbit \
strlcpy strlcat)
AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot getcwd eaccess\
truncate ftruncate chsize times utimes utimensat fcntl lockf lstat\
@ -1124,7 +1124,7 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot getcwd eacce
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
getpriority getrlimit setrlimit sysconf \
dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp snprintf\
setsid telldir seekdir fchmod cosh sinh tanh log2 round signbit\
setsid telldir seekdir fchmod cosh sinh tanh log2 round\
setuid setgid daemon select_large_fdset setenv unsetenv\
mktime timegm gmtime_r clock_gettime gettimeofday\
pread sendfile shutdown sigaltstack)

19
missing/signbit.c Normal file
View file

@ -0,0 +1,19 @@
#include <limits.h>
#include "ruby.h"
int
signbit(double x)
{
enum {double_per_long = sizeof(double) / sizeof(long)};
enum {long_msb = sizeof(long) * CHAR_BIT - 1};
union {double d; unsigned long i[double_per_long];} u;
unsigned long l;
u.d = x;
#ifdef WORDS_BIGENDIAN
l = u.i[0];
#else
l = u.i[double_per_long - 1];
#endif
return (int)(l >> long_msb);
}