mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-24 17:04:19 +00:00
Upload
Digital Research
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright 1982
|
||||
Alcyon Corporation
|
||||
8716 Production Ave.
|
||||
San Diego, Ca. 92121
|
||||
*/
|
||||
|
||||
/*char *version "@(#)ltof.c 1.2 10/19/83"; */
|
||||
|
||||
/*
|
||||
* Floating Point Long to Float Routine :
|
||||
* Front End to FFP Floating Point Package.
|
||||
*
|
||||
* double
|
||||
* fpltof(larg)
|
||||
* long larg;
|
||||
*
|
||||
* Return : Floating Point representation of Long Fixed point integer
|
||||
*/
|
||||
|
||||
long
|
||||
fpltof(l)
|
||||
long l;
|
||||
{
|
||||
register long exp;
|
||||
register int sign;
|
||||
|
||||
if (l < 0L) { /* signed ?? */
|
||||
sign = 1;
|
||||
l = -l;
|
||||
}
|
||||
else
|
||||
sign = 0;
|
||||
if (l == 0L)
|
||||
return(0L);
|
||||
exp = 24L;
|
||||
for( ; l & 0x7f000000; exp++) /* something in upper 7 bits */
|
||||
l >>= 1;
|
||||
for( ; !(l & 0x00800000); exp--) /* get mantissa : .F */
|
||||
l <<= 1;
|
||||
l =<< 8; /* mantissa (.F) into top 24 bits */
|
||||
exp += 0x40;
|
||||
l =| (exp & 0x7f);
|
||||
if (sign)
|
||||
l |= 0x80;
|
||||
return(l);
|
||||
}
|
||||
Reference in New Issue
Block a user