Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1906 serge 1
/*
2
 * Written by J.T. Conklin .
3
 * Public domain.
4
 */
5
 
6
	.file	"ceil.s"
7
	.text
8
	.align 4
9
.globl _ceil
10
	.def	_ceil;	.scl	2;	.type	32;	.endef
11
_ceil:
12
	fldl	4(%esp)
13
	subl	$8,%esp
14
 
15
	fstcw	4(%esp)			/* store fpu control word */
16
 
17
	/* We use here %edx although only the low 1 bits are defined.
18
	   But none of the operations should care and they are faster
19
	   than the 16 bit operations.  */
20
	movl	$0x0800,%edx		/* round towards +oo */
21
	orl	4(%esp),%edx
22
	andl	$0xfbff,%edx
23
	movl	%edx,(%esp)
24
	fldcw	(%esp)			/* load modified control word */
25
 
26
	frndint				/* round */
27
 
28
	fldcw	4(%esp)			/* restore original control word */
29
 
30
	addl	$8,%esp
31
	ret