blitz_ftoi.linux.x86.s 374 B

123456789101112131415161718192021222324252627282930
  1. format ELF
  2. public bbFloatToInt
  3. section "code" ;code
  4. ;0[esp]=ret
  5. ;4[esp]=double
  6. bbFloatToInt:
  7. fld qword [esp+4]
  8. sub esp,12
  9. fist dword [esp]
  10. fst dword [esp+4]
  11. fisub dword [esp]
  12. fstp dword [esp+8]
  13. pop eax
  14. pop ecx
  15. pop edx
  16. test ecx,ecx
  17. js negative
  18. add edx,0x7fffffff
  19. sbb eax,0
  20. ret
  21. negative:
  22. xor ecx,ecx
  23. test edx,edx
  24. setg cl
  25. add eax,ecx
  26. ret