1 /* Copyright (c) 1998, 1999 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 Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 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 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <rpc/types.h>
23 /* XDR 64bit integers */
25 xdr_int64_t (XDR
*xdrs
, int64_t *ip
)
33 t1
= (int32_t) ((*ip
) >> 32);
35 return (XDR_PUTINT32(xdrs
, &t1
) && XDR_PUTINT32(xdrs
, &t2
));
37 if (!XDR_GETINT32(xdrs
, &t1
) || !XDR_GETINT32(xdrs
, &t2
))
39 *ip
= ((int64_t) t1
) << 32;
49 /* XDR 64bit unsigned integers */
51 xdr_uint64_t (XDR
*xdrs
, uint64_t *uip
)
59 t1
= (uint32_t) ((*uip
) >> 32);
60 t2
= (uint32_t) (*uip
);
61 return (XDR_PUTINT32 (xdrs
, (int32_t *) &t1
) &&
62 XDR_PUTINT32(xdrs
, (int32_t *) &t2
));
64 if (!XDR_GETINT32(xdrs
, (int32_t *) &t1
) ||
65 !XDR_GETINT32(xdrs
, (int32_t *) &t2
))
67 *uip
= ((uint64_t) t1
) << 32;
77 /* XDR 32bit integers */
79 xdr_int32_t (XDR
*xdrs
, int32_t *lp
)
84 return XDR_PUTINT32 (xdrs
, lp
);
86 return XDR_GETINT32 (xdrs
, lp
);
94 /* XDR 32bit unsigned integers */
96 xdr_uint32_t (XDR
*xdrs
, uint32_t *ulp
)
101 return XDR_PUTINT32 (xdrs
, (int32_t *) ulp
);
103 return XDR_GETINT32 (xdrs
, (int32_t *) ulp
);
111 /* XDR 16bit integers */
113 xdr_int16_t (XDR
*xdrs
, int16_t *ip
)
121 return XDR_PUTINT32 (xdrs
, &t
);
123 if (!XDR_GETINT32 (xdrs
, &t
))
134 /* XDR 16bit unsigned integers */
136 xdr_uint16_t (XDR
*xdrs
, uint16_t *uip
)
143 ut
= (uint32_t) *uip
;
144 return XDR_GETINT32 (xdrs
, (int32_t *) &ut
);
146 if (!XDR_PUTINT32 (xdrs
, (int32_t *) &ut
))
148 *uip
= (uint16_t) ut
;
157 /* XDR 8bit integers */
159 xdr_int8_t (XDR
*xdrs
, int8_t *ip
)
167 return XDR_PUTINT32 (xdrs
, &t
);
169 if (!XDR_GETINT32 (xdrs
, &t
))
180 /* XDR 8bit unsigned integers */
182 xdr_uint8_t (XDR
*xdrs
, uint8_t *uip
)
189 ut
= (uint32_t) *uip
;
190 return XDR_GETINT32 (xdrs
, (int32_t *) &ut
);
192 if (!XDR_PUTINT32 (xdrs
, (int32_t *) &ut
))