|
|
1.1 root 1:
2: #include "fp.h"
3: #include "fp_in_krnl.h"
4:
5: .text
6: .globl _Kcvtdl
7: .globl _Kcvtdu
8: _Kcvtdu:
9: _Kcvtdl: .word 0x003c # we use r2,r3,r4,r5
10:
11: #
12: #Some initializations:
13: #
14: clrl r3 # r3 - negative flag.
15: movl 4(fp),r0 # fetch operand.
16: movl 8(fp),r1
17: #
18: #get exponent
19: #
20: andl3 $EXPMASK,r0,r2 # r2 will hold the exponent.
21: jeql retzero
22: cmpl $TWO_EXP,r2 # if exponent is less then -2,return zero.
23: jgtr retzero
24: andl2 $0!EXPSIGN,r2 # turn off biased exponent sign
25: shrl $EXPSHIFT,r2,r2
26: #
27: #get fraction
28: #
29: bbc $31,r0,positive # if negative remember it.
30: incl r3
31: positive:
32: # clear the non fraction parts.
33: andl2 $(0!(EXPMASK | SIGNBIT)),r0
34: # add the hidden bit.
35: orl2 $(0!CLEARHID),r0
36: subl2 $24,r2 # compute the shift.
37: jgtr shift_left
38: mnegl r2,r2
39: shrl r2,r0,r0 # shift right.
40: jmp shifted
41: shift_left:
42: cmpl r2,$7
43: jgtr overflow
44: go_on: shlq r2,r0,r0 # shift right.
45: shifted:
46: bbc $0,r3,done # check for negative
47: mnegl r0,r0
48: done:
49: ret
50:
51: retzero:
52: clrl r0
53: ret
54: overflow:
55: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.