Annotation of 40BSD/libc/gen/modf.s, revision 1.1.1.1

1.1       root        1: #
                      2: #      double modf (value, iptr)
                      3: #              double value;
                      4: #              double *iptr;
                      5: #
                      6: #      Modf returns the fractional part of "value", and stores the integer
                      7: #      part indirectly through "iptr".
                      8: #
                      9: #      Entry point
                     10: #
                     11:        .text
                     12:        .align  1
                     13:        .globl  _modf
                     14: _modf: .word   0x0000          # We use r0-r2, but do not save them
                     15: #
                     16: #      This instruction does the following:
                     17: #
                     18: #              Extend the long floating value at 4(ap) with 0, and
                     19: #              multiply it by 1.0.  Store the integer part of the result
                     20: #              in r2, and the fractional part of the result in r0-r1.
                     21: #
                     22:        emodf   4(ap),$0,$0f1.0,r2,r0   # How did you like
                     23:                                        # THAT, sports fans?
                     24:        jvs     iovfl                   # Jump if integer overflow
                     25:        cvtld   r2,*12(ap)              # Else store integer result
                     26:        ret                             #    and return
                     27: #
                     28: #      Integer overflow occurred...develop the integer part by
                     29: #      subtracting the fractional part from the argument.
                     30: #
                     31: iovfl: subd3   r0,4(ap),*12(ap)        # Develop integer part
                     32:        ret

unix.superglobalmegacorp.com

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