diff options
| author | welinder@troll.com <welinder@troll.com> | 2004-10-02 22:49:30 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:27 -0700 |
| commit | 7a52af572ba9e8280cc28e73b575e56ab03214fd (patch) | |
| tree | 2558dbdfdd45f91635d13d139bc32002f5ef951a /compat-solaris.c | |
| parent | 4250a6355c2a29764f5a8b31a1a22087439068dd (diff) | |
| download | sparse-dev-7a52af572ba9e8280cc28e73b575e56ab03214fd.tar.gz | |
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 00000000..d8fa1d9e --- /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; +} |
