diff options
author | 2004-10-02 22:49:30 -0700 | |
---|---|---|
committer | 2005-04-07 21:03:27 -0700 | |
commit | 7a52af572ba9e8280cc28e73b575e56ab03214fd (patch) | |
tree | 2558dbdfdd45f91635d13d139bc32002f5ef951a /compat-solaris.c | |
parent | Be more lenient in placement of 'asm("reg")' variable hard-register (diff) | |
download | sparse-7a52af572ba9e8280cc28e73b575e56ab03214fd.tar.gz sparse-7a52af572ba9e8280cc28e73b575e56ab03214fd.tar.bz2 sparse-7a52af572ba9e8280cc28e73b575e56ab03214fd.zip |
Add compatibility file for solaris.
Diffstat (limited to 'compat-solaris.c')
-rw-r--r-- | compat-solaris.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/compat-solaris.c b/compat-solaris.c new file mode 100644 index 0000000..d8fa1d9 --- /dev/null +++ b/compat-solaris.c @@ -0,0 +1,34 @@ +#include "lib.h" + +#include "compat/id-files-stat.c" +#include "compat/mmap-blob.c" + + +#include <floatingpoint.h> +#include <limits.h> +#include <errno.h> + +long double string_to_ld(const char *str, char **endptr) +{ + long double res; + decimal_record dr; + enum decimal_string_form form; + decimal_mode dm; + fp_exception_field_type excp; + char *echar; + + string_to_decimal ((char **)&str, INT_MAX, 0, + &dr, &form, &echar); + if (endptr) *endptr = (char *)str; + + if (form == invalid_form) { + errno = EINVAL; + return 0.0; + } + + dm.rd = fp_nearest; + decimal_to_quadruple (&res, &dm, &dr, &excp); + if (excp & ((1 << fp_overflow) | (1 << fp_underflow))) + errno = ERANGE; + return res; +} |