/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1988 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "base_conversion.h"
/*
* Fundamental utilities of base conversion required for sprintf - but too
* complex or too seldom used to be worth assembly language coding.
*/
/* p = x * y + c ; return (p/10000 << 16 | p%10000) */
unsigned long
{
unsigned long p = x * (unsigned long) y + c;
return ((p / 10000) << 16) | (p % 10000);
}
/* p = x * y ; return p */
unsigned long
{
return (x * (unsigned long)y);
}
/* p = x * y ; return (p/10000 << 16 | p%10000) */
unsigned long
{
unsigned long p = x * (unsigned long) y;
return ((p / 10000) << 16) | (p % 10000);
}
/* p = x << n + c ; return (p/10000 << 16 | p%10000) */
unsigned long
{
unsigned long p = (((unsigned long) x) << n) + c;
return ((p / 10000) << 16) | (p % 10000);
}
/* p = x * 10000 + c ; return p */
unsigned long
{
return (x * (unsigned long) 10000 + c);
}
/* p = x << 16 + c ; return (p/10000 << 16 | p%10000) */
unsigned long
{
unsigned long p = (((unsigned long) x) << 16) + c;
return ((p / 10000) << 16) | (p % 10000);
}
/* p = c ; return (p/10000 << 16 | p%10000) */
unsigned long
_carry_out_b10000(unsigned long c)
{
return ((c / 10000) << 16) | (c % 10000);
}
void
{
/*
* Multiply a base-10**4 significand by 2<<multiplier. Extend length
* as necessary to accommodate carries.
*/
int j;
unsigned long carry;
long p;
carry = 0;
for (j = 0; j < length; j++) {
carry = p >> 16;
}
while (carry != 0) {
p = _carry_out_b10000(carry);
carry = p >> 16;
}
}
void
{
/*
* Multiply a base-2**16 significand by 2<<multiplier. Extend length
* as necessary to accommodate carries.
*/
long unsigned p;
int j;
unsigned long carry;
carry = 0;
for (j = 0; j < length; j++) {
carry = p >> 16;
}
if (carry != 0) {
}
}
void
{
/* *pb = *pb / 2**multiplier to normalize. 15 <= multiplier <= 1 */
/* Any bits shifted out got to *sticky. */
long unsigned p;
int j;
unsigned long carry;
carry = 0;
carry = p & 0xffff;
}
}
void
{
/*
* Multiply a base-10**4 significand by multiplier. Extend length as
* necessary to accommodate carries.
*/
int j;
unsigned long carry;
long p;
carry = 0;
carry = p >> 16;
}
while (carry != 0) {
p = _carry_out_b10000(carry);
carry = p >> 16;
}
}
void
long unsigned carry)
{
/*
* Multiply a base-2**16 significand by multiplier. Extend length as
* necessary to accommodate carries.
*/
long unsigned p;
int j;
for (j = 0; j < length; j++) {
carry = p >> 16;
}
if (carry != 0) {
}
}
void
{
/*
* Multiply a base-10**4 significand by 2**multiplier. Extend length
* as necessary to accommodate carries.
*/
int j;
long unsigned carry, p;
carry = 0;
for (j = 0; j < length; j++) {
carry = p >> 16;
}
while (carry != 0) {
p = _carry_out_b10000(carry);
carry = p >> 16;
}
}
void
{
/*
* Converts pu into a bigfloat *pb of minimal length; exponent *pe
* such that pu = *pb * 2 ** *pe
*/
}
if (pb->bsignificand[0] == 0) {
}
#ifdef DEBUG
#endif
}
void
{
/* *pbf *= 65536 ; += carry ; */
long unsigned p;
int j;
carry = p >> 16;
}
while (carry != 0) {
p = _carry_out_b10000(carry);
carry = p >> 16;
}
}
void
{
/* Convert _big_float from binary form to decimal form. */
int i;
} else {
}
* add next significand. */
}
* each trailing zero. */
_mul_65536short(pd, (unsigned long) 0);
}
#ifdef DEBUG
printf(" _big_binary_to_big_decimal ");
#endif
}