home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2243 < prev    next >
Internet Message Format  |  1990-12-28  |  3KB

  1. From: glenn@extro.ucc.su.OZ.AU (Glenn Geers)
  2. Newsgroups: alt.sources
  3. Subject: 80386 alternative math lib - ooops
  4. Message-ID: <1990Dec8.071559.9387@metro.ucc.su.OZ.AU>
  5. Date: 8 Dec 90 07:15:59 GMT
  6.  
  7. Hi,
  8.     I sent an old version of ieee_ext.s in my original group of postings.
  9. Please replace that file with the one affixed to this posting.
  10. This is not a shar file...
  11.             Cheers,
  12.                 Glenn
  13.  
  14.  
  15. ------------------CUT HERE--------------------
  16. /*
  17. ** This file is part of the alternative 80386 math library and is
  18. ** covered by the GNU General Public license with my modification
  19. ** as noted in the README file that accompanied this file.
  20. **
  21. ** Copyright 1990 G. Geers
  22. **
  23. */
  24.  
  25.     .align 4
  26.     .globl isnan
  27. isnan:
  28.     pushl %ebp
  29.     movl %esp,%ebp
  30.  
  31.     movl 12(%ebp), %eax
  32.     andl $0x7ff00000, %eax
  33.     cmpl $0x7ff00000, %eax
  34.     jne .Lnotnan
  35.     movl 12(%ebp), %eax
  36.     andl $0xfffff, %eax
  37.     orl 8(%ebp), %eax
  38.     je .Lnotnan
  39.  
  40.     movl $1, %eax
  41.     leave 
  42.     ret
  43.  
  44. .Lnotnan:
  45.     movl $0, %eax
  46.  
  47. .Ldone:
  48.     leave
  49.     ret
  50.  
  51.     .align 4
  52.     .globl isinf
  53. isinf:
  54.     pushl %ebp
  55.     movl %esp,%ebp
  56.  
  57.     movl 12(%ebp), %eax
  58.     andl $0x7ff00000, %eax
  59.     cmpl $0x7ff00000, %eax
  60.     je .Lcouldbeinf
  61.  
  62. .Lnotinf:
  63.     movl $0, %eax
  64.     leave
  65.     ret
  66.  
  67. .Lcouldbeinf:
  68.     movl 12(%ebp), %eax
  69.     andl $0xfffff, %eax
  70.     orl 8(%ebp), %eax
  71.     jne .Lnotinf
  72.  
  73.     movl $1, %eax
  74.     leave
  75.     ret
  76.  
  77.     .align 4
  78.     .globl iszero
  79. iszero:
  80.     pushl %ebp
  81.     movl %esp,%ebp
  82.  
  83.     movl 12(%ebp), %eax
  84.     cmpl $0x0, %eax
  85.     je .Lcouldbezero
  86. .Lnotzero:
  87.     movl $0, %eax
  88.     leave
  89.     ret
  90.  
  91. .Lcouldbezero:
  92.     andl $0xfffff, %eax
  93.     orl 8(%ebp), %eax
  94.     jne .Lnotzero
  95.  
  96.     movl $1, %eax
  97.     leave
  98.     ret
  99.  
  100.     .align 4
  101.     .globl signbit
  102. signbit:
  103.     pushl %ebp
  104.     movl %esp,%ebp
  105.  
  106.     movl 12(%ebp), %eax
  107.     andl $0x80000000, %eax
  108.     cmpl $0x80000000, %eax
  109.     jne .Lpos
  110.     movl $1, %eax
  111.     leave
  112.     ret
  113.  
  114. .Lpos:
  115.     movl $0, %eax
  116.     leave
  117.     ret
  118.  
  119.     .align 4
  120.     .globl issubnormal
  121. issubnormal:
  122.     pushl %ebp
  123.     movl %esp,%ebp
  124.  
  125.     movl 12(%ebp), %eax
  126.     andl $0x7ff00000, %eax
  127.     cmpl $0x0, %eax
  128.     je .Lcouldbesub
  129.  
  130. .Lnotsubnorm:
  131.     movl $0, %eax
  132.     leave
  133.     ret
  134.  
  135. .Lcouldbesub:
  136.     movl 12(%ebp), %eax
  137.     andl $0xfffff, %eax
  138.     orl 8(%ebp), %eax
  139.     je .Lnotsubnorm
  140.  
  141.     movl $1, %eax
  142.     leave
  143.     ret
  144.  
  145.     .align 4
  146.     .globl isnormal
  147. isnormal:
  148.     pushl %ebp
  149.     movl %esp,%ebp
  150.  
  151.     movl 12(%ebp), %eax
  152.     andl $0x7ff00000, %eax /* mask sign bit */
  153.     xorl $0x7ff00000, %eax 
  154.     cmpl $0x0, %eax
  155.     je .Lnotnorm
  156.     cmpl $0x7ff00000, %eax
  157.     je .Lcouldbenorm
  158.  
  159. .Lnorm:
  160.     movl $1, %eax
  161.     leave
  162.     ret
  163.  
  164. .Lcouldbenorm:
  165.     movl 12(%ebp), %eax
  166.     andl $0xfffff, %eax
  167.     orl 8(%ebp), %eax
  168.     je .Lnorm
  169.  
  170. .Lnotnorm:
  171.     movl $0, %eax
  172.     leave
  173.     ret
  174. ----------------CUT HERE--------------------
  175. --
  176. Glenn Geers                       | "So when it's over, we're back to people.
  177. Department of Theoretical Physics |  Just to prove that human touch can have
  178. The University of Sydney          |  no equal."
  179. Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'
  180.