/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lint.h"
#include "base_conversion.h"
static void
/* Right shift significand sticky by n bits. */
{
int i;
i++);
if (i >= UNPACKED_SIZE) {
return;
} else {
for (i = 0; i < (UNPACKED_SIZE - 1); i++)
pu->significand[i] = 0;
return;
}
}
while (n >= 32) { /* big shift */
for (i = UNPACKED_SIZE - 2; i >= 0; i--)
pu->significand[0] = 0;
n -= 32;
}
if (n >= 1) { /* small shift */
for (i = 0; i < UNPACKED_SIZE; i++) {
}
if (shiftout != 0)
}
}
static int
/* Returns 1 if overflow should go to infinity, 0 if to max finite. */
{
int inf;
switch (rd) {
case fp_nearest:
inf = 1;
break;
case fp_tozero:
inf = 0;
break;
case fp_positive:
break;
case fp_negative:
break;
}
return (inf);
}
static void
/*
* Round according to current rounding mode. pu must be shifted to so that
* the roundbit is pu->significand[roundword] & 0x80000000
*/
{
int is;
/* Condense extra bits into sticky bottom of roundword. */
break;
}
return;
switch (rd) {
case fp_nearest:
break;
case fp_tozero:
increment = 0;
break;
case fp_positive:
break;
case fp_negative:
break;
}
if (increment) {
do {
is--;
}
}
}
if ((rd == fp_nearest) &&
/* ambiguous case */
}
}
void
{
int e;
e = 0;
case fp_zero:
break;
case fp_infinity:
break;
case fp_quiet:
break;
case fp_normal:
/* rounded back up to normal */
e |= (1 << fp_underflow);
goto ret;
}
if (e & (1 << fp_inexact))
e |= (1 << fp_underflow);
goto ret;
}
}
goto infinity;
goto ret;
}
}
ret:
*ex = (fp_exception_field_type)e;
}
void
{
int e;
e = 0;
case fp_zero:
kluge.f.significand2 = 0;
break;
case fp_infinity:
kluge.f.significand2 = 0;
break;
case fp_quiet:
break;
case fp_normal:
/* rounded back up to normal */
kluge.f.significand2 = 0;
e |= (1 << fp_underflow);
goto ret;
}
if (e & (1 << fp_inexact))
e |= (1 << fp_underflow);
goto ret;
}
}
goto infinity;
goto ret;
}
break;
}
ret:
*ex = (fp_exception_field_type)e;
}
void
{
int e;
e = 0;
case fp_zero:
kluge.f.significand = 0;
kluge.f.significand2 = 0;
break;
case fp_infinity:
kluge.f.significand2 = 0;
break;
case fp_quiet:
break;
case fp_normal:
/* rounded back up to normal */
kluge.f.significand2 = 0;
e |= (1 << fp_underflow);
goto ret;
}
if (e & (1 << fp_inexact))
e |= (1 << fp_underflow);
goto ret;
}
goto infinity;
goto ret;
}
break;
}
ret:
*ex = (fp_exception_field_type)e;
}
void
{
int e;
e = 0;
case fp_zero:
kluge.f.significand2 = 0;
kluge.f.significand3 = 0;
kluge.f.significand4 = 0;
break;
case fp_infinity:
kluge.f.significand2 = 0;
kluge.f.significand3 = 0;
kluge.f.significand4 = 0;
break;
case fp_quiet:
break;
case fp_normal:
/* rounded back up to normal */
kluge.f.significand2 = 0;
kluge.f.significand3 = 0;
kluge.f.significand4 = 0;
e |= (1 << fp_underflow);
goto ret;
}
if (e & (1 << fp_inexact))
e |= (1 << fp_underflow);
goto ret;
}
}
goto infinity;
goto ret;
}
break;
}
ret:
*ex = (fp_exception_field_type)e;
}