mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
ANSIfy libc/quad
Some of these routines exist in both lib/libc/quad/ and sys/libkern/. r325988 ANSIfied sys/libkern. Update libc/quad to match. PR: 223641 Reported by: bde Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
ff9154be8b
commit
6492be46b8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339510
|
@ -47,8 +47,7 @@ __FBSDID("$FreeBSD$");
|
|||
* either x or y (the choice to compare with x or y is arbitrary).
|
||||
*/
|
||||
quad_t
|
||||
__adddi3(a, b)
|
||||
quad_t a, b;
|
||||
__adddi3(quad_t a, quad_t b)
|
||||
{
|
||||
union uu aa, bb, sum;
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Return a & b, in quad.
|
||||
*/
|
||||
quad_t
|
||||
__anddi3(a, b)
|
||||
quad_t a, b;
|
||||
__anddi3(quad_t a, quad_t b)
|
||||
{
|
||||
union uu aa, bb;
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* This is the same as logical shift left!
|
||||
*/
|
||||
quad_t
|
||||
__ashldi3(a, shift)
|
||||
quad_t a;
|
||||
qshift_t shift;
|
||||
__ashldi3(quad_t a, qshift_t shift)
|
||||
{
|
||||
union uu aa;
|
||||
|
||||
|
|
|
@ -45,9 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Shift a (signed) quad value right (arithmetic shift right).
|
||||
*/
|
||||
quad_t
|
||||
__ashrdi3(a, shift)
|
||||
quad_t a;
|
||||
qshift_t shift;
|
||||
__ashrdi3(quad_t a, qshift_t shift)
|
||||
{
|
||||
union uu aa;
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ __FBSDID("$FreeBSD$");
|
|||
* signed.
|
||||
*/
|
||||
int
|
||||
__cmpdi2(a, b)
|
||||
quad_t a, b;
|
||||
__cmpdi2(quad_t a, quad_t b)
|
||||
{
|
||||
union uu aa, bb;
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* ??? if -1/2 should produce -1 on this machine, this code is wrong
|
||||
*/
|
||||
quad_t
|
||||
__divdi3(a, b)
|
||||
quad_t a, b;
|
||||
__divdi3(quad_t a, quad_t b)
|
||||
{
|
||||
u_quad_t ua, ub, uq;
|
||||
int neg;
|
||||
|
|
|
@ -46,8 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* We clamp anything that is out of range.
|
||||
*/
|
||||
quad_t
|
||||
__fixdfdi(x)
|
||||
double x;
|
||||
__fixdfdi(double x)
|
||||
{
|
||||
if (x < 0)
|
||||
if (x <= QUAD_MIN)
|
||||
|
|
|
@ -51,8 +51,7 @@ __FBSDID("$FreeBSD$");
|
|||
* of range becomes UQUAD_MAX.
|
||||
*/
|
||||
u_quad_t
|
||||
__fixunsdfdi(x)
|
||||
double x;
|
||||
__fixunsdfdi(double x)
|
||||
{
|
||||
double toppart;
|
||||
union uu t;
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Convert (signed) quad to double.
|
||||
*/
|
||||
double
|
||||
__floatdidf(x)
|
||||
quad_t x;
|
||||
__floatdidf(quad_t x)
|
||||
{
|
||||
double d;
|
||||
union uu u;
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Convert (signed) quad to float.
|
||||
*/
|
||||
float
|
||||
__floatdisf(x)
|
||||
quad_t x;
|
||||
__floatdisf(quad_t x)
|
||||
{
|
||||
float f;
|
||||
union uu u;
|
||||
|
|
|
@ -46,8 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* This is exactly like floatdidf.c except that negatives never occur.
|
||||
*/
|
||||
double
|
||||
__floatunsdidf(x)
|
||||
u_quad_t x;
|
||||
__floatunsdidf(u_quad_t x)
|
||||
{
|
||||
double d;
|
||||
union uu u;
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Return a | b, in quad.
|
||||
*/
|
||||
quad_t
|
||||
__iordi3(a, b)
|
||||
quad_t a, b;
|
||||
__iordi3(quad_t a, quad_t b)
|
||||
{
|
||||
union uu aa, bb;
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* This is the same as arithmetic shift left!
|
||||
*/
|
||||
quad_t
|
||||
__lshldi3(a, shift)
|
||||
quad_t a;
|
||||
qshift_t shift;
|
||||
__lshldi3(quad_t a, qshift_t shift)
|
||||
{
|
||||
union uu aa;
|
||||
|
||||
|
|
|
@ -45,9 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Shift an (unsigned) quad value right (logical shift right).
|
||||
*/
|
||||
quad_t
|
||||
__lshrdi3(a, shift)
|
||||
quad_t a;
|
||||
qshift_t shift;
|
||||
__lshrdi3(quad_t a, qshift_t shift)
|
||||
{
|
||||
union uu aa;
|
||||
|
||||
|
|
|
@ -48,8 +48,7 @@ __FBSDID("$FreeBSD$");
|
|||
* If -1/2 should produce -1 on this machine, this code is wrong.
|
||||
*/
|
||||
quad_t
|
||||
__moddi3(a, b)
|
||||
quad_t a, b;
|
||||
__moddi3(quad_t a, quad_t b)
|
||||
{
|
||||
u_quad_t ua, ub, ur;
|
||||
int neg;
|
||||
|
|
|
@ -101,8 +101,7 @@ __FBSDID("$FreeBSD$");
|
|||
static quad_t __lmulq(u_long, u_long);
|
||||
|
||||
quad_t
|
||||
__muldi3(a, b)
|
||||
quad_t a, b;
|
||||
__muldi3(quad_t a, quad_t b)
|
||||
{
|
||||
union uu u, v, low, prod;
|
||||
u_long high, mid, udiff, vdiff;
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Return -a (or, equivalently, 0 - a), in quad. See subdi3.c.
|
||||
*/
|
||||
quad_t
|
||||
__negdi2(a)
|
||||
quad_t a;
|
||||
__negdi2(quad_t a)
|
||||
{
|
||||
union uu aa, res;
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* than `not'.
|
||||
*/
|
||||
quad_t
|
||||
__one_cmpldi2(a)
|
||||
quad_t a;
|
||||
__one_cmpldi2(quad_t a)
|
||||
{
|
||||
union uu aa;
|
||||
|
||||
|
|
|
@ -82,8 +82,7 @@ shl(digit *p, int len, int sh)
|
|||
* leading zeros).
|
||||
*/
|
||||
u_quad_t
|
||||
__qdivrem(uq, vq, arq)
|
||||
u_quad_t uq, vq, *arq;
|
||||
__qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
|
||||
{
|
||||
union uu tmp;
|
||||
digit *u, *v, *q;
|
||||
|
|
|
@ -46,8 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* from a single u_long difference x-y occurs if and only if (x-y) > x.
|
||||
*/
|
||||
quad_t
|
||||
__subdi3(a, b)
|
||||
quad_t a, b;
|
||||
__subdi3(quad_t a, quad_t b)
|
||||
{
|
||||
union uu aa, bb, diff;
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Neither a nor b are considered signed.
|
||||
*/
|
||||
int
|
||||
__ucmpdi2(a, b)
|
||||
u_quad_t a, b;
|
||||
__ucmpdi2(u_quad_t a, u_quad_t b)
|
||||
{
|
||||
union uu aa, bb;
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Divide two unsigned quads.
|
||||
*/
|
||||
u_quad_t
|
||||
__udivdi3(a, b)
|
||||
u_quad_t a, b;
|
||||
__udivdi3(u_quad_t a, u_quad_t b)
|
||||
{
|
||||
|
||||
return (__qdivrem(a, b, (u_quad_t *)0));
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Return remainder after dividing two unsigned quads.
|
||||
*/
|
||||
u_quad_t
|
||||
__umoddi3(a, b)
|
||||
u_quad_t a, b;
|
||||
__umoddi3(u_quad_t a, u_quad_t b)
|
||||
{
|
||||
u_quad_t r;
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||
* Return a ^ b, in quad.
|
||||
*/
|
||||
quad_t
|
||||
__xordi3(a, b)
|
||||
quad_t a, b;
|
||||
__xordi3(quad_t a, quad_t b)
|
||||
{
|
||||
union uu aa, bb;
|
||||
|
||||
|
|
Loading…
Reference in a new issue