|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 388 (0x184)
Types: TextFile
Notes: UNIX file
Names: »ltoc.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦f4b8d8c84⟧ UNIX Filesystem
└─⟦this⟧ »libc/gen/ltoc.c«
/*
* Convert long to comp_t style number.
* A comp_t contains 3 bits of base-8 exponent
* and a 13-bit mantissa. Only unsigned
* numbers can be comp_t numbers.
*/
#include <types.h>
#define MAXMANT 017777 /* 2^13-1 = largest mantissa */
comp_t
ltoc(l)
long l;
{
register exp;
if (l < 0)
return (0);
for (exp = 0; l > MAXMANT; exp++)
l >>= 3;
return ((exp<<13) | l);
}