Cygwin: Add new APIs tc[gs]etwinsize()
[newlib-cygwin.git] / newlib / libc / machine / powerpc / atosfix16.c
blobb069d71d1cd41c2b8c475c7c381e44d1757ecaed
1 /*
2 FUNCTION
3 <<atosfix16>>, <<atosfix32>>, <<atosfix64>>---string to signed fixed-point
5 INDEX
6 atosfix16
7 INDEX
8 atosfix32
9 INDEX
10 atosfix64
11 INDEX
12 _atosfix16_r
13 INDEX
14 _atosfix32_r
15 INDEX
16 _atosfix64_r
18 SYNOPSIS
19 #include <stdlib.h>
20 __int16_t atosfix16(const char *<[s]>);
21 __int32_t atosfix32(const char *<[s]>);
22 __int64_t atosfix32(const char *<[s]>);
24 __int16_t _atosfix16_r(struct __reent *, const char *<[s]>);
25 __int32_t _atosfix32_r(struct __reent *, const char *<[s]>);
26 __int64_t _atosfix32_r(struct __reent *, const char *<[s]>);
28 DESCRIPTION
29 <<atosfix16>> converts the initial portion of a string to a sign
30 + 15-bit fraction fixed point value.
31 <<atosfix32>> converts the initial portion of a string to a sign
32 + 31-bit fraction fixed point value.
33 <<atosfix64>> converts the initial portion of a string to a sign
34 + 63-bit fraction fixed point value.
35 <<atosfix16(s)>> is implemented as <<strtosfix16(s, NULL).>>
36 <<atosfix32(s)>> is implemented as <<strtosfix32(s, NULL).>>
37 <<atosfix64(s)>> is implemented as <<strtosfix64(s, NULL).>>
39 The alternate functions <<_atosfix16_r>>, <<_atosfix32_r>>,
40 and <<_atosfix64_r>> are reentrant versions.
41 The extra argument <[reent]> is a pointer to a reentrancy structure.
43 RETURNS
44 The functions return the converted value, if any. If no conversion was
45 made, <<0>> is returned. If saturation occurs, <<ERANGE>> is stored
46 in errno.
48 PORTABILITY
49 <<atosfix16>>, <<atosfix32>>, and <<atosfix64>> are non-standard.
51 No supporting OS subroutines are directly required. The
52 OS subroutines required by <<strtod>> are used.
56 * Jeff Johnston - 02/13/2002
59 #ifdef __SPE__
61 #include <stdlib.h>
62 #include <_ansi.h>
64 __int16_t
65 _atosfix16_r (struct _reent *reent,
66 const char *s)
68 return _strtosfix16_r (reent, s, NULL);
71 #ifndef _REENT_ONLY
72 __int16_t
73 atosfix16 (const char *s)
75 return strtosfix16 (s, NULL);
78 #endif /* !_REENT_ONLY */
80 #endif /* __SPE__ */