mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
parent
32e289b1d8
commit
9367253b4d
15 changed files with 390 additions and 124 deletions
|
@ -17,19 +17,24 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
.source __FILE__
|
||||
|
||||
ceill: .profilable
|
||||
sub $24,%rsp
|
||||
fldt 32(%rsp)
|
||||
fnstcw 14(%rsp)
|
||||
movzwl 14(%rsp),%eax
|
||||
andb $-13,%ah
|
||||
orb $8,%ah
|
||||
movw %ax,12(%rsp)
|
||||
fldcw 12(%rsp)
|
||||
// Returns smallest integral not less than 𝑥.
|
||||
//
|
||||
// @param 𝑥 is long double passed on stack
|
||||
// @return long double in %st
|
||||
ceill: pushq %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
sub $16,%rsp
|
||||
fnstcw -2(%rbp)
|
||||
fldt 16(%rbp)
|
||||
movzwl -2(%rbp),%eax
|
||||
and $-13,%ah
|
||||
or $8,%ah
|
||||
mov %ax,-4(%rbp)
|
||||
fldcw -4(%rbp)
|
||||
frndint
|
||||
fldcw 14(%rsp)
|
||||
add $24,%rsp
|
||||
fldcw -2(%rbp)
|
||||
leave
|
||||
ret
|
||||
.endfn ceill,globl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue