Annotation of linux/kernel/math/compare.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * linux/kernel/math/compare.c
        !             3:  *
        !             4:  * (C) 1991 Linus Torvalds
        !             5:  */
        !             6: 
        !             7: /*
        !             8:  * temporary real comparison routines
        !             9:  */
        !            10: 
        !            11: #include <linux/math_emu.h>
        !            12: 
        !            13: #define clear_Cx() (I387.swd &= ~0x4500)
        !            14: 
        !            15: static void normalize(temp_real * a)
        !            16: {
        !            17:        int i = a->exponent & 0x7fff;
        !            18:        int sign = a->exponent & 0x8000;
        !            19: 
        !            20:        if (!(a->a || a->b)) {
        !            21:                a->exponent = 0;
        !            22:                return;
        !            23:        }
        !            24:        while (i && a->b >= 0) {
        !            25:                i--;
        !            26:                __asm__("addl %0,%0 ; adcl %1,%1"
        !            27:                        :"=r" (a->a),"=r" (a->b)
        !            28:                        :"0" (a->a),"1" (a->b));
        !            29:        }
        !            30:        a->exponent = i | sign;
        !            31: }
        !            32: 
        !            33: void ftst(const temp_real * a)
        !            34: {
        !            35:        temp_real b;
        !            36: 
        !            37:        clear_Cx();
        !            38:        b = *a;
        !            39:        normalize(&b);
        !            40:        if (b.a || b.b || b.exponent) {
        !            41:                if (b.exponent < 0)
        !            42:                        set_C0();
        !            43:        } else
        !            44:                set_C3();
        !            45: }
        !            46: 
        !            47: void fcom(const temp_real * src1, const temp_real * src2)
        !            48: {
        !            49:        temp_real a;
        !            50: 
        !            51:        a = *src1;
        !            52:        a.exponent ^= 0x8000;
        !            53:        fadd(&a,src2,&a);
        !            54:        ftst(&a);
        !            55: }
        !            56: 
        !            57: void fucom(const temp_real * src1, const temp_real * src2)
        !            58: {
        !            59:        fcom(src1,src2);
        !            60: }

unix.superglobalmegacorp.com

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