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