Annotation of coherent/b/kernel/emulator/reg_constant.c, revision 1.1

1.1     ! root        1: /*---------------------------------------------------------------------------+
        !             2:  |  reg_constant.c                                                           |
        !             3:  |                                                                           |
        !             4:  | All of the constant FPU_REGs                                              |
        !             5:  |                                                                           |
        !             6:  | Copyright (C) 1992    W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
        !             7:  |                       Australia.  E-mail [email protected]    |
        !             8:  |                                                                           |
        !             9:  |                                                                           |
        !            10:  +---------------------------------------------------------------------------*/
        !            11: 
        !            12: #include "fpu_system.h"
        !            13: #include "fpu_emu.h"
        !            14: #include "status_w.h"
        !            15: #include "reg_constant.h"
        !            16: 
        !            17: 
        !            18: FPU_REG CONST_1    = { SIGN_POS, TW_Valid, EXP_BIAS,
        !            19:                            0x00000000, 0x80000000 };
        !            20: FPU_REG CONST_2    = { SIGN_POS, TW_Valid, EXP_BIAS+1,
        !            21:                            0x00000000, 0x80000000 };
        !            22: FPU_REG CONST_HALF = { SIGN_POS, TW_Valid, EXP_BIAS-1,
        !            23:                            0x00000000, 0x80000000 };
        !            24: FPU_REG CONST_L2T  = { SIGN_POS, TW_Valid, EXP_BIAS+1,
        !            25:                            0xcd1b8afe, 0xd49a784b };
        !            26: FPU_REG CONST_L2E  = { SIGN_POS, TW_Valid, EXP_BIAS,
        !            27:                            0x5c17f0bc, 0xb8aa3b29 };
        !            28: FPU_REG CONST_PI   = { SIGN_POS, TW_Valid, EXP_BIAS+1,
        !            29:                            0x2168c235, 0xc90fdaa2 };
        !            30: FPU_REG CONST_PI2  = { SIGN_POS, TW_Valid, EXP_BIAS,
        !            31:                            0x2168c235, 0xc90fdaa2 };
        !            32: FPU_REG CONST_PI4  = { SIGN_POS, TW_Valid, EXP_BIAS-1,
        !            33:                            0x2168c235, 0xc90fdaa2 };
        !            34: FPU_REG CONST_LG2  = { SIGN_POS, TW_Valid, EXP_BIAS-2,
        !            35:                            0xfbcff799, 0x9a209a84 };
        !            36: FPU_REG CONST_LN2  = { SIGN_POS, TW_Valid, EXP_BIAS-1,
        !            37:                            0xd1cf79ac, 0xb17217f7 };
        !            38: 
        !            39: /* Only the sign (and tag) is used in internal zeroes */
        !            40: FPU_REG CONST_Z    = { SIGN_POS, TW_Zero, 0,          0x0,        0x0 };
        !            41: 
        !            42: /* Only the sign and significand (and tag) are used in internal NaNs */
        !            43: /* The 80486 never generates one of these 
        !            44: FPU_REG CONST_SNAN = { SIGN_POS, TW_NaN, EXP_OVER, 0x00000001, 0x80000000 };
        !            45:  */
        !            46: /* This is the real indefinite QNaN */
        !            47: FPU_REG CONST_QNaN = { SIGN_NEG, TW_NaN, EXP_OVER, 0x00000000, 0xC0000000 };
        !            48: 
        !            49: /* Only the sign (and tag) is used in internal infinities */
        !            50: FPU_REG CONST_INF  = { SIGN_POS, TW_Infinity, EXP_OVER, 0x00000000, 0x80000000 };
        !            51: 
        !            52: 
        !            53: 
        !            54: static void fld_const(FPU_REG *c)
        !            55: {
        !            56:   FPU_REG *st_new_ptr;
        !            57: 
        !            58:   if ( STACK_OVERFLOW )
        !            59:     {
        !            60:       stack_overflow();
        !            61:       return;
        !            62:     }
        !            63:   push();
        !            64:   reg_move(c, FPU_st0_ptr);
        !            65:   status_word &= ~SW_C1;
        !            66: }
        !            67: 
        !            68: 
        !            69: static void fld1()
        !            70: {
        !            71:   fld_const(&CONST_1);
        !            72: }
        !            73: 
        !            74: static void fldl2t()
        !            75: {
        !            76:   fld_const(&CONST_L2T);
        !            77: }
        !            78: 
        !            79: static void fldl2e()
        !            80: {
        !            81:   fld_const(&CONST_L2E);
        !            82: }
        !            83: 
        !            84: static void fldpi()
        !            85: {
        !            86:   fld_const(&CONST_PI);
        !            87: }
        !            88: 
        !            89: static void fldlg2()
        !            90: {
        !            91:   fld_const(&CONST_LG2);
        !            92: }
        !            93: 
        !            94: static void fldln2()
        !            95: {
        !            96:   fld_const(&CONST_LN2);
        !            97: }
        !            98: 
        !            99: static void fldz()
        !           100: {
        !           101:   fld_const(&CONST_Z);
        !           102: }
        !           103: 
        !           104: static FUNC constants_table[] = {
        !           105:   fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, Un_impl
        !           106: };
        !           107: 
        !           108: void fconst()
        !           109: {
        !           110:   (constants_table[FPU_rm])();
        !           111: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.