|
|
1.1 ! root 1: ////////// ! 2: / libc/crt/i386/udcvt.s ! 3: / i386 C runtime library. ! 4: / IEEE software floating point support. ! 5: ////////// ! 6: ! 7: ////////// ! 8: / unsigned int _udcvt() ! 9: / ! 10: / Convert double in %edx:%eax to unsigned int, return in %eax. ! 11: ////////// ! 12: ! 13: BIAS .equ 1023 ! 14: EXPMASK .equ 0x7FF00000 ! 15: MANMASK .equ 0x000FFFFF ! 16: HIDDEN .equ 0x00100000 ! 17: MAXUINT .equ 0xFFFFFFFF ! 18: ! 19: .globl _udcvt ! 20: ! 21: _udcvt: ! 22: push %ecx ! 23: orl %edx, %edx ! 24: js ?zero / negative arg, return 0 ! 25: mov %ecx, %edx ! 26: andl %ecx, $EXPMASK / shifted biased exponent to ECX ! 27: shrl %ecx, $20 / biased exponent ! 28: subl %ecx, $BIAS / unbiased exponent ! 29: jl ?zero / too small, return 0 ! 30: cmpl %ecx, $31 ! 31: jg ?inf / too big, return MAXUINT ! 32: andl %edx, $MANMASK / extract hi mantissa in EDX ! 33: orl %edx, $HIDDEN / restore hidden bit ! 34: shrd %eax, %edx, $21 / mantissa in EAX ! 35: negl %ecx ! 36: addl %ecx, $31 / shift count to CL ! 37: shrl %eax, %cl / shift mantissa to correct position ! 38: pop %ecx ! 39: ret ! 40: ! 41: ?inf: ! 42: mov %eax, $MAXUINT / overflow, return MAXUINT ! 43: pop %ecx ! 44: ret ! 45: ! 46: ?zero: ! 47: subl %eax, %eax ! 48: pop %ecx ! 49: ret ! 50: ! 51: / end of libc/crt/i386/udcvt.s
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.