|
|
1.1 root 1: /*
2: * Convert long to comp_t style number.
3: * A comp_t contains 3 bits of base-8 exponent
4: * and a 13-bit mantissa. Only unsigned
5: * numbers can be comp_t numbers.
6: */
7:
8: #include <sys/types.h>
9:
10: #define MAXMANT 017777 /* 2^13-1 = largest mantissa */
11:
12: comp_t
13: ltoc(l)
14: long l;
15: {
16: register exp;
17:
18: if (l < 0)
19: return (0);
20: for (exp = 0; l > MAXMANT; exp++)
21: l >>= 3;
22: return ((exp<<13) | l);
23: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.