KNF, integrate with standard include files (quad -> quad_t etc.)
[unix-history] / usr / src / lib / libc / quad / ucmpdi2.c
index 4e294e1..27611c9 100644 (file)
@@ -2,30 +2,31 @@
  * Copyright (c) 1992 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1992 The Regents of the University of California.
  * All rights reserved.
  *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
  * %sccs.include.redist.c%
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  * %sccs.include.redist.c%
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ucmpdi2.c  5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)ucmpdi2.c  5.5 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include "longlong.h"
+#include "quad.h"
 
 
-long int
-__ucmpdi2 (a, b)
-     long long a, b;
+/*
+ * Return 0, 1, or 2 as a <, =, > b respectively.
+ * Neither a nor b are considered signed.
+ */
+int
+__ucmpdi2(a, b)
+       u_quad_t a, b;
 {
 {
-  long_long au, bu;
-
-  au.ll = a, bu.ll = b;
+       union uu aa, bb;
 
 
-  if ((unsigned) au.s.high < (unsigned) bu.s.high)
-    return 0;
-  else if ((unsigned) au.s.high > (unsigned) bu.s.high)
-    return 2;
-  if ((unsigned) au.s.low < (unsigned) bu.s.low)
-    return 0;
-  else if ((unsigned) au.s.low > (unsigned) bu.s.low)
-    return 2;
-  return 1;
+       aa.uq = a;
+       bb.uq = b;
+       return (aa.ul[H] < bb.ul[H] ? 0 : aa.ul[H] > bb.ul[H] ? 2 :
+           aa.ul[L] < bb.ul[L] ? 0 : aa.ul[L] > bb.ul[L] ? 2 : 1);
 }
 }