summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-08-14 23:18:03 +0000
committerguenther <guenther@openbsd.org>2016-08-14 23:18:03 +0000
commit60e29447380c2a7085979385eb4e985f0d44970e (patch)
tree61e51098fb707f99613b597796b6ae1be6787f9c /lib/libc
parentConvert quad_t to long long (diff)
downloadwireguard-openbsd-60e29447380c2a7085979385eb4e985f0d44970e.tar.xz
wireguard-openbsd-60e29447380c2a7085979385eb4e985f0d44970e.zip
Reduce qabs() and qdiv() to aliases of llabs() and lldiv().
Merge the manual pages and call them deprecated there. ok and manpage tweak jmc@, ok natano@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/hidden/stdlib.h6
-rw-r--r--lib/libc/stdlib/Makefile.inc8
-rw-r--r--lib/libc/stdlib/div.37
-rw-r--r--lib/libc/stdlib/imaxdiv.37
-rw-r--r--lib/libc/stdlib/labs.310
-rw-r--r--lib/libc/stdlib/ldiv.37
-rw-r--r--lib/libc/stdlib/llabs.c4
-rw-r--r--lib/libc/stdlib/lldiv.313
-rw-r--r--lib/libc/stdlib/lldiv.c4
-rw-r--r--lib/libc/stdlib/qabs.356
-rw-r--r--lib/libc/stdlib/qabs.c37
-rw-r--r--lib/libc/stdlib/qdiv.361
-rw-r--r--lib/libc/stdlib/qdiv.c50
13 files changed, 39 insertions, 231 deletions
diff --git a/lib/libc/hidden/stdlib.h b/lib/libc/hidden/stdlib.h
index 8898423c8d8..76a9c4d809c 100644
--- a/lib/libc/hidden/stdlib.h
+++ b/lib/libc/hidden/stdlib.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdlib.h,v 1.7 2016/03/13 18:34:21 guenther Exp $ */
+/* $OpenBSD: stdlib.h,v 1.8 2016/08/14 23:18:03 guenther Exp $ */
/* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */
/*-
@@ -119,8 +119,8 @@ PROTO_DEPRECATED(nrand48);
PROTO_DEPRECATED(posix_openpt);
PROTO_DEPRECATED(ptsname);
PROTO_NORMAL(putenv);
-PROTO_DEPRECATED(qabs);
-PROTO_DEPRECATED(qdiv);
+/*PROTO_DEPRECATED(qabs); alias of llabs */
+/*PROTO_DEPRECATED(qdiv); alias of lldiv */
PROTO_NORMAL(qsort);
PROTO_DEPRECATED(radixsort);
PROTO_STD_DEPRECATED(rand);
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index e04d13b8395..3489e440211 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.60 2016/05/02 12:59:24 millert Exp $
+# $OpenBSD: Makefile.inc,v 1.61 2016/08/14 23:18:03 guenther Exp $
# stdlib sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/stdlib ${LIBCSRCDIR}/stdlib
@@ -11,8 +11,8 @@ SRCS+= a64l.c abort.c atexit.c atoi.c atof.c atol.c atoll.c bsearch.c \
realpath.c remque.c setenv.c strtoimax.c \
strtol.c strtoll.c strtonum.c strtoul.c strtoull.c strtoumax.c \
system.c tfind.c tsearch.c _rand48.c drand48.c erand48.c jrand48.c \
- lcong48.c lrand48.c mrand48.c nrand48.c seed48.c srand48.c qabs.c \
- qdiv.c _Exit.c icdb.c
+ lcong48.c lrand48.c mrand48.c nrand48.c seed48.c srand48.c \
+ _Exit.c icdb.c
.if (${MACHINE_CPU} == "i386")
SRCS+= abs.S div.S labs.S ldiv.S
@@ -27,5 +27,5 @@ MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 atoll.3 \
bsearch.3 div.3 ecvt.3 exit.3 getenv.3 getopt.3 getopt_long.3 \
getsubopt.3 hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 \
lldiv.3 lsearch.3 malloc.3 posix_memalign.3 posix_openpt.3 ptsname.3 \
- qabs.3 qdiv.3 qsort.3 radixsort.3 rand48.3 rand.3 random.3 realpath.3 \
+ qsort.3 radixsort.3 rand48.3 rand.3 random.3 realpath.3 \
strtod.3 strtonum.3 strtol.3 strtoul.3 system.3 tsearch.3
diff --git a/lib/libc/stdlib/div.3 b/lib/libc/stdlib/div.3
index 1a2a3262690..421400a2943 100644
--- a/lib/libc/stdlib/div.3
+++ b/lib/libc/stdlib/div.3
@@ -27,9 +27,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: div.3,v 1.11 2013/06/05 03:39:23 tedu Exp $
+.\" $OpenBSD: div.3,v 1.12 2016/08/14 23:18:03 guenther Exp $
.\"
-.Dd $Mdocdate: June 5 2013 $
+.Dd $Mdocdate: August 14 2016 $
.Dt DIV 3
.Os
.Sh NAME
@@ -55,8 +55,7 @@ and
.Sh SEE ALSO
.Xr imaxdiv 3 ,
.Xr ldiv 3 ,
-.Xr lldiv 3 ,
-.Xr qdiv 3
+.Xr lldiv 3
.Sh STANDARDS
The
.Fn div
diff --git a/lib/libc/stdlib/imaxdiv.3 b/lib/libc/stdlib/imaxdiv.3
index 20f02e75712..0d4f7653734 100644
--- a/lib/libc/stdlib/imaxdiv.3
+++ b/lib/libc/stdlib/imaxdiv.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: imaxdiv.3,v 1.6 2014/11/30 21:21:59 schwarze Exp $
+.\" $OpenBSD: imaxdiv.3,v 1.7 2016/08/14 23:18:03 guenther Exp $
.\"
-.Dd $Mdocdate: November 30 2014 $
+.Dd $Mdocdate: August 14 2016 $
.Dt IMAXDIV 3
.Os
.Sh NAME
@@ -57,8 +57,7 @@ and
.Sh SEE ALSO
.Xr div 3 ,
.Xr ldiv 3 ,
-.Xr lldiv 3 ,
-.Xr qdiv 3
+.Xr lldiv 3
.Sh STANDARDS
The
.Fn imaxdiv
diff --git a/lib/libc/stdlib/labs.3 b/lib/libc/stdlib/labs.3
index 55cf548ea55..272a14e3fe2 100644
--- a/lib/libc/stdlib/labs.3
+++ b/lib/libc/stdlib/labs.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: labs.3,v 1.13 2014/11/30 21:21:59 schwarze Exp $
+.\" $OpenBSD: labs.3,v 1.14 2016/08/14 23:18:03 guenther Exp $
.\"
-.Dd $Mdocdate: November 30 2014 $
+.Dd $Mdocdate: August 14 2016 $
.Dt LABS 3
.Os
.Sh NAME
@@ -44,6 +44,8 @@
.Fn labs "long i"
.Ft long long
.Fn llabs "long long j"
+.Ft quad_t
+.Fn qabs "quad_t j"
.Sh DESCRIPTION
The
.Fn labs
@@ -53,6 +55,10 @@ The
.Fn llabs
function returns the absolute value of the long long integer
.Fa j .
+The
+.Fn qabs
+function is a deprecated equivalent of
+.Fn llabs .
.Sh SEE ALSO
.Xr abs 3 ,
.Xr cabs 3 ,
diff --git a/lib/libc/stdlib/ldiv.3 b/lib/libc/stdlib/ldiv.3
index a8835ab6ac8..1fa6f38c457 100644
--- a/lib/libc/stdlib/ldiv.3
+++ b/lib/libc/stdlib/ldiv.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: ldiv.3,v 1.12 2013/07/17 05:42:11 schwarze Exp $
+.\" $OpenBSD: ldiv.3,v 1.13 2016/08/14 23:18:03 guenther Exp $
.\"
-.Dd $Mdocdate: July 17 2013 $
+.Dd $Mdocdate: August 14 2016 $
.Dt LDIV 3
.Os
.Sh NAME
@@ -57,8 +57,7 @@ and
.Sh SEE ALSO
.Xr div 3 ,
.Xr imaxdiv 3 ,
-.Xr lldiv 3 ,
-.Xr qdiv 3
+.Xr lldiv 3
.Sh STANDARDS
The
.Fn ldiv
diff --git a/lib/libc/stdlib/llabs.c b/lib/libc/stdlib/llabs.c
index fc2cd8261ca..f4a260f4a8f 100644
--- a/lib/libc/stdlib/llabs.c
+++ b/lib/libc/stdlib/llabs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: llabs.c,v 1.3 2007/01/08 19:39:25 deraadt Exp $ */
+/* $OpenBSD: llabs.c,v 1.4 2016/08/14 23:18:03 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -36,3 +36,5 @@ llabs(long long j)
{
return (j < 0 ? -j : j);
}
+
+__weak_alias(qabs, llabs);
diff --git a/lib/libc/stdlib/lldiv.3 b/lib/libc/stdlib/lldiv.3
index cb2abf681eb..ab0bec9fa51 100644
--- a/lib/libc/stdlib/lldiv.3
+++ b/lib/libc/stdlib/lldiv.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: lldiv.3,v 1.5 2014/11/30 21:21:59 schwarze Exp $
+.\" $OpenBSD: lldiv.3,v 1.6 2016/08/14 23:18:03 guenther Exp $
.\"
-.Dd $Mdocdate: November 30 2014 $
+.Dd $Mdocdate: August 14 2016 $
.Dt LLDIV 3
.Os
.Sh NAME
@@ -41,6 +41,8 @@
.In stdlib.h
.Ft lldiv_t
.Fn lldiv "long long num" "long long denom"
+.Ft qdiv_t
+.Fn qdiv "quad_t num" "quad_t denom"
.Sh DESCRIPTION
The
.Fn lldiv
@@ -54,11 +56,14 @@ members named
.Fa quot
and
.Fa rem .
+The
+.Fn qdiv
+function is a deprecated equivalent of
+.Fn lldiv .
.Sh SEE ALSO
.Xr div 3 ,
.Xr imaxdiv 3 ,
-.Xr ldiv 3 ,
-.Xr qdiv 3
+.Xr ldiv 3
.Sh STANDARDS
The
.Fn lldiv
diff --git a/lib/libc/stdlib/lldiv.c b/lib/libc/stdlib/lldiv.c
index e8d6c978b37..59c37b878cd 100644
--- a/lib/libc/stdlib/lldiv.c
+++ b/lib/libc/stdlib/lldiv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lldiv.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */
+/* $OpenBSD: lldiv.c,v 1.2 2016/08/14 23:18:03 guenther Exp $ */
/*
* Copyright (c) 1990 Regents of the University of California.
* All rights reserved.
@@ -48,3 +48,5 @@ lldiv(long long num, long long denom)
}
return (r);
}
+
+__weak_alias(qdiv, lldiv);
diff --git a/lib/libc/stdlib/qabs.3 b/lib/libc/stdlib/qabs.3
deleted file mode 100644
index 6703072e720..00000000000
--- a/lib/libc/stdlib/qabs.3
+++ /dev/null
@@ -1,56 +0,0 @@
-.\" Copyright (c) 1990, 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $OpenBSD: qabs.3,v 1.13 2013/06/05 03:39:23 tedu Exp $
-.\"
-.Dd $Mdocdate: June 5 2013 $
-.Dt QABS 3
-.Os
-.Sh NAME
-.Nm qabs
-.Nd return the absolute value of a quad integer
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft quad_t
-.Fn qabs "quad_t j"
-.Sh DESCRIPTION
-The
-.Fn qabs
-function returns the absolute value of the quad integer
-.Fa j .
-.Sh SEE ALSO
-.Xr abs 3 ,
-.Xr cabs 3 ,
-.Xr floor 3 ,
-.Xr imaxabs 3 ,
-.Xr labs 3
-.Sh BUGS
-The absolute value of the most negative integer remains negative.
diff --git a/lib/libc/stdlib/qabs.c b/lib/libc/stdlib/qabs.c
deleted file mode 100644
index 656b93c822f..00000000000
--- a/lib/libc/stdlib/qabs.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $OpenBSD: qabs.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-
-quad_t
-qabs(quad_t j)
-{
- return(j < 0 ? -j : j);
-}
diff --git a/lib/libc/stdlib/qdiv.3 b/lib/libc/stdlib/qdiv.3
deleted file mode 100644
index 5f5275493eb..00000000000
--- a/lib/libc/stdlib/qdiv.3
+++ /dev/null
@@ -1,61 +0,0 @@
-.\" Copyright (c) 1990, 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $OpenBSD: qdiv.3,v 1.10 2013/06/05 03:39:23 tedu Exp $
-.\"
-.Dd $Mdocdate: June 5 2013 $
-.Dt QDIV 3
-.Os
-.Sh NAME
-.Nm qdiv
-.Nd return quotient and remainder from division
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft qdiv_t
-.Fn qdiv "quad_t num" "quad_t denom"
-.Sh DESCRIPTION
-The
-.Fn qdiv
-function computes the value
-.Fa num Ns / Ns Fa denom
-and returns the quotient and remainder in a structure named
-.Li qdiv_t
-that contains two
-.Li quad integer
-members named
-.Fa quot
-and
-.Fa rem .
-.Sh SEE ALSO
-.Xr div 3 ,
-.Xr imaxdiv 3 ,
-.Xr ldiv 3 ,
-.Xr lldiv 3
diff --git a/lib/libc/stdlib/qdiv.c b/lib/libc/stdlib/qdiv.c
deleted file mode 100644
index f3db0915ed2..00000000000
--- a/lib/libc/stdlib/qdiv.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: qdiv.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
-/*
- * Copyright (c) 1990 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h> /* qdiv_t */
-
-qdiv_t
-qdiv(quad_t num, quad_t denom)
-{
- qdiv_t r;
-
- /* see div.c for comments */
-
- r.quot = num / denom;
- r.rem = num % denom;
- if (num >= 0 && r.rem < 0) {
- r.quot++;
- r.rem -= denom;
- }
- return (r);
-}