1 /* Copyright (c) 1998, 1999, 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <rpc/types.h>
22 /* XDR 64bit integers */
24 xdr_int64_t (XDR *xdrs, int64_t *ip)
27 /* This must be unsigned, otherwise we get problems with sign
28 extension in the DECODE case. */
34 t1 = (int32_t) ((*ip) >> 32);
36 return (XDR_PUTINT32(xdrs, &t1) && XDR_PUTINT32(xdrs, (int32_t *) &t2));
38 if (!XDR_GETINT32(xdrs, &t1) || !XDR_GETINT32(xdrs, (int32_t *) &t2))
40 *ip = ((int64_t) t1) << 32;
49 strong_alias_untyped(xdr_int64_t,xdr_quad_t)
51 /* XDR 64bit unsigned integers */
53 xdr_uint64_t (XDR *xdrs, uint64_t *uip)
61 t1 = (uint32_t) ((*uip) >> 32);
62 t2 = (uint32_t) (*uip);
63 return (XDR_PUTINT32 (xdrs, (int32_t *) &t1) &&
64 XDR_PUTINT32(xdrs, (int32_t *) &t2));
66 if (!XDR_GETINT32(xdrs, (int32_t *) &t1) ||
67 !XDR_GETINT32(xdrs, (int32_t *) &t2))
69 *uip = ((uint64_t) t1) << 32;
78 strong_alias_untyped(xdr_uint64_t,xdr_u_quad_t)
80 /* XDR 32bit integers */
82 xdr_int32_t (XDR *xdrs, int32_t *lp)
87 return XDR_PUTINT32 (xdrs, lp);
89 return XDR_GETINT32 (xdrs, lp);
97 /* XDR 32bit unsigned integers */
99 xdr_uint32_t (XDR *xdrs, uint32_t *ulp)
104 return XDR_PUTINT32 (xdrs, (int32_t *) ulp);
106 return XDR_GETINT32 (xdrs, (int32_t *) ulp);
114 /* XDR 16bit integers */
116 xdr_int16_t (XDR *xdrs, int16_t *ip)
124 return XDR_PUTINT32 (xdrs, &t);
126 if (!XDR_GETINT32 (xdrs, &t))
137 /* XDR 16bit unsigned integers */
139 xdr_uint16_t (XDR *xdrs, uint16_t *uip)
146 ut = (uint32_t) *uip;
147 return XDR_PUTINT32 (xdrs, (int32_t *) &ut);
149 if (!XDR_GETINT32 (xdrs, (int32_t *) &ut))
151 *uip = (uint16_t) ut;
160 /* XDR 8bit integers */
162 xdr_int8_t (XDR *xdrs, int8_t *ip)
170 return XDR_PUTINT32 (xdrs, &t);
172 if (!XDR_GETINT32 (xdrs, &t))
183 /* XDR 8bit unsigned integers */
185 xdr_uint8_t (XDR *xdrs, uint8_t *uip)
192 ut = (uint32_t) *uip;
193 return XDR_PUTINT32 (xdrs, (int32_t *) &ut);
195 if (!XDR_GETINT32 (xdrs, (int32_t *) &ut))