|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1986 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * This code is derived from software contributed to Berkeley by ! 6: * Computer Consoles Inc. ! 7: * ! 8: * Redistribution and use in source and binary forms are permitted ! 9: * provided that: (1) source distributions retain this entire copyright ! 10: * notice and comment, and (2) distributions including binaries display ! 11: * the following acknowledgement: ``This product includes software ! 12: * developed by the University of California, Berkeley and its contributors'' ! 13: * in the documentation or other materials provided with the distribution ! 14: * and in all advertising materials mentioning features or use of this ! 15: * software. Neither the name of the University nor the names of its ! 16: * contributors may be used to endorse or promote products derived ! 17: * from this software without specific prior written permission. ! 18: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 19: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 20: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 21: */ ! 22: ! 23: #if defined(SYSLIBC_SCCS) && !defined(lint) ! 24: .asciz "@(#)cvtud.s 1.3 (Berkeley) 6/1/90" ! 25: #endif /* SYSLIBC_SCCS and not lint */ ! 26: ! 27: #include <tahoemath/fp.h> ! 28: #include "DEFS.h" ! 29: ! 30: XENTRY(cvtud, R2|R3|R4|R5) ! 31: # ! 32: # Some initializations: ! 33: # ! 34: clrl r2 # r2 - exponent. ! 35: movl 4(fp),r0 # fetch operand. ! 36: jeql retzero # return zero. ! 37: # ! 38: # Compute exponent: ! 39: # ! 40: positive: ! 41: ffs r0,r1 ! 42: incl r1 ! 43: addl2 r1,r2 ! 44: shrl r1,r0,r0 ! 45: jneq positive # look for more set bits. ! 46: # ! 47: # we have the exponent in r2. ! 48: # ! 49: movl 4(fp),r0 # r0,r1 will hold the resulting f.p. number. ! 50: clrl r1 ! 51: # ! 52: # Shift the fraction part to its proper place: ! 53: # ! 54: subl3 r2,$HID_POS,r3 ! 55: jlss shiftr # if less then zero we have to shift right. ! 56: shll r3,r0,r0 # else we shift left. ! 57: jmp shifted ! 58: shiftr: ! 59: mnegl r3,r3 ! 60: shrq r3,r0,r0 ! 61: shifted: ! 62: andl2 $CLEARHID,r0 # clear the hidden bit. ! 63: shal $EXPSHIFT,r2,r2 # shift the exponent to its proper place. ! 64: orl2 $EXPSIGN,r2 # set the exponent sign bit(to bias it). ! 65: orl2 r2,r0 # combine exponent & fraction. ! 66: sign_ok: ! 67: ret ! 68: ! 69: retzero: ! 70: clrl r0 ! 71: clrl r1 ! 72: ret ! 73: ! 74:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.