1*54745Storek /*- 2*54745Storek * Copyright (c) 1992 The Regents of the University of California. 3*54745Storek * All rights reserved. 4*54745Storek * 5*54745Storek * This software was developed by the Computer Systems Engineering group 6*54745Storek * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7*54745Storek * contributed to Berkeley. 8*54745Storek * 9*54745Storek * %sccs.include.redist.c% 10*54745Storek */ 11*54745Storek 12*54745Storek #if defined(LIBC_SCCS) && !defined(lint) 13*54745Storek static char sccsid[] = "@(#)fixsfdi.c 5.1 (Berkeley) 07/07/92"; 14*54745Storek #endif /* LIBC_SCCS and not lint */ 15*54745Storek 16*54745Storek #include "quad.h" 17*54745Storek 18*54745Storek /* 19*54745Storek * Convert float to (signed) quad. 20*54745Storek * We clamp anything that is out of range. 21*54745Storek * 22*54745Storek * N.B.: must use new ANSI syntax (sorry). 23*54745Storek */ 24*54745Storek long long __fixsfdi(float x)25*54745Storek__fixsfdi(float x) 26*54745Storek { 27*54745Storek if (x < 0) 28*54745Storek if (x <= QUAD_MIN) 29*54745Storek return (QUAD_MIN); 30*54745Storek else 31*54745Storek return ((quad_t)-(u_quad_t)-x); 32*54745Storek else 33*54745Storek if (x >= QUAD_MAX) 34*54745Storek return (QUAD_MAX); 35*54745Storek else 36*54745Storek return ((quad_t)(u_quad_t)x); 37*54745Storek } 38