DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦9033cc663⟧ TextFile

    Length: 390 (0x186)
    Types: TextFile
    Notes: UNIX file
    Names: »ctol.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »libc/gen/ctol.c« 

TextFile

/*
 * Convert a comp_t style number to a long.
 * 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 */

long
ctol(c)
comp_t c;
{
	register exp;
	long mant;

	mant = c&MAXMANT;
	exp = (c>>13)&07;
	while (exp--)
		mant <<= 3;
	return (mant);
}