s_ceil.S revision 1.2
11.1Sjtc/* 21.1Sjtc * Copyright (c) 1993,94 Winning Strategies, Inc. 31.1Sjtc * All rights reserved. 41.1Sjtc * 51.1Sjtc * Redistribution and use in source and binary forms, with or without 61.1Sjtc * modification, are permitted provided that the following conditions 71.1Sjtc * are met: 81.1Sjtc * 1. Redistributions of source code must retain the above copyright 91.1Sjtc * notice, this list of conditions and the following disclaimer. 101.1Sjtc * 2. Redistributions in binary form must reproduce the above copyright 111.1Sjtc * notice, this list of conditions and the following disclaimer in the 121.1Sjtc * documentation and/or other materials provided with the distribution. 131.1Sjtc * 3. All advertising materials mentioning features or use of this software 141.1Sjtc * must display the following acknowledgement: 151.1Sjtc * This product includes software developed by Winning Strategies, Inc. 161.1Sjtc * 4. The name of the author may not be used to endorse or promote products 171.1Sjtc * derived from this software without specific prior written permission. 181.1Sjtc * 191.1Sjtc * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 201.1Sjtc * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 211.1Sjtc * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 221.1Sjtc * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 231.1Sjtc * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 241.1Sjtc * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 251.1Sjtc * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 261.1Sjtc * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 271.1Sjtc * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 281.1Sjtc * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 291.1Sjtc */ 301.1Sjtc 311.1Sjtc/* 321.1Sjtc * Written by: 331.1Sjtc * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. 341.1Sjtc */ 351.1Sjtc 361.1Sjtc#include <machine/asm.h> 371.1Sjtc 381.2SjtcRCSID("$Id: s_ceil.S,v 1.2 1994/03/12 01:30:35 jtc Exp $") 391.2Sjtc 401.1SjtcENTRY(ceil) 411.1Sjtc pushl %ebp 421.1Sjtc movl %esp,%ebp 431.1Sjtc subl $8,%esp 441.1Sjtc 451.1Sjtc fstcw -12(%ebp) /* store fpu control word */ 461.1Sjtc movw -12(%ebp),%dx 471.1Sjtc orw $0x0800,%dx /* round towards +oo */ 481.1Sjtc andw $0xfbff,%dx 491.1Sjtc movw %dx,-16(%ebp) 501.1Sjtc fldcw -16(%ebp) /* load modfied control word */ 511.1Sjtc 521.1Sjtc fldl 8(%ebp); /* round */ 531.1Sjtc frndint 541.1Sjtc 551.1Sjtc fldcw -12(%ebp) /* restore original control word */ 561.1Sjtc 571.1Sjtc leave 581.1Sjtc ret 59