]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sunrpc/xdr_intXX_t.c
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[thirdparty/glibc.git] / sunrpc / xdr_intXX_t.c
index 6c1fca2b23b8204d829d22ab6861b89bb8da0774..9d2f92e10d74bcc1774f93979c5e650c648646f6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
 bool_t
 xdr_int64_t (XDR *xdrs, int64_t *ip)
 {
-  int32_t t1, t2;
+  int32_t t1;
+  /* This must be unsigned, otherwise we get problems with sign
+     extension in the DECODE case.  */
+  uint32_t t2;
 
   switch (xdrs->x_op)
     {
@@ -43,7 +46,7 @@ xdr_int64_t (XDR *xdrs, int64_t *ip)
       if (!XDR_GETINT32(xdrs, &t1) || !XDR_GETINT32(xdrs, &t2))
         return FALSE;
       *ip = ((int64_t) t1) << 32;
-      *ip |= (uint32_t) t2;    /* Avoid sign extension.  */
+      *ip |= t2;
       return TRUE;
     case XDR_FREE:
       return TRUE;