|
|
1.1 root 1: #ifdef LIBC_SCCS
2: .asciz "@(#)cvtud.s 1.1 (Berkeley/CCI) 7/2/86"
3: #endif LIBC_SCCS
4:
5: #include <tahoemath/fp.h>
6: #include "DEFS.h"
7:
8: XENTRY(cvtud, R2|R3|R4|R5)
9: #
10: # Some initializations:
11: #
12: clrl r2 # r2 - exponent.
13: movl 4(fp),r0 # fetch operand.
14: jeql retzero # return zero.
15: #
16: # Compute exponent:
17: #
18: positive:
19: ffs r0,r1
20: incl r1
21: addl2 r1,r2
22: shrl r1,r0,r0
23: jneq positive # look for more set bits.
24: #
25: # we have the exponent in r2.
26: #
27: movl 4(fp),r0 # r0,r1 will hold the resulting f.p. number.
28: clrl r1
29: #
30: # Shift the fraction part to its proper place:
31: #
32: subl3 r2,$HID_POS,r3
33: jlss shiftr # if less then zero we have to shift right.
34: shll r3,r0,r0 # else we shift left.
35: jmp shifted
36: shiftr:
37: mnegl r3,r3
38: shrq r3,r0,r0
39: shifted:
40: andl2 $CLEARHID,r0 # clear the hidden bit.
41: shal $EXPSHIFT,r2,r2 # shift the exponent to its proper place.
42: orl2 $EXPSIGN,r2 # set the exponent sign bit(to bias it).
43: orl2 r2,r0 # combine exponent & fraction.
44: sign_ok:
45: ret
46:
47: retzero:
48: clrl r0
49: clrl r1
50: ret
51:
52:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.