1*5a172a1eSDan McDonald /* 2*5a172a1eSDan McDonald * CDDL HEADER START 3*5a172a1eSDan McDonald * 4*5a172a1eSDan McDonald * The contents of this file are subject to the terms of the 5*5a172a1eSDan McDonald * Common Development and Distribution License (the "License"). 6*5a172a1eSDan McDonald * You may not use this file except in compliance with the License. 7*5a172a1eSDan McDonald * 8*5a172a1eSDan McDonald * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5a172a1eSDan McDonald * or http://www.opensolaris.org/os/licensing. 10*5a172a1eSDan McDonald * See the License for the specific language governing permissions 11*5a172a1eSDan McDonald * and limitations under the License. 12*5a172a1eSDan McDonald * 13*5a172a1eSDan McDonald * When distributing Covered Code, include this CDDL HEADER in each 14*5a172a1eSDan McDonald * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5a172a1eSDan McDonald * If applicable, add the following below this CDDL HEADER, with the 16*5a172a1eSDan McDonald * fields enclosed by brackets "[]" replaced with your own identifying 17*5a172a1eSDan McDonald * information: Portions Copyright [yyyy] [name of copyright owner] 18*5a172a1eSDan McDonald * 19*5a172a1eSDan McDonald * CDDL HEADER END 20*5a172a1eSDan McDonald */ 21*5a172a1eSDan McDonald 22*5a172a1eSDan McDonald /* 23*5a172a1eSDan McDonald * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24*5a172a1eSDan McDonald * Use is subject to license terms. 25*5a172a1eSDan McDonald */ 26*5a172a1eSDan McDonald 27*5a172a1eSDan McDonald #include "lint.h" 28*5a172a1eSDan McDonald #include "base_conversion.h" 29*5a172a1eSDan McDonald 30*5a172a1eSDan McDonald /* 31*5a172a1eSDan McDonald * Returns IEEE mode/status and 32*5a172a1eSDan McDonald * sets up standard environment for base conversion. 33*5a172a1eSDan McDonald */ 34*5a172a1eSDan McDonald void 35*5a172a1eSDan McDonald __get_ieee_flags(__ieee_flags_type *b) { 36*5a172a1eSDan McDonald extern void _getcw(), _getsw(), _putcw(); 37*5a172a1eSDan McDonald int cw; 38*5a172a1eSDan McDonald 39*5a172a1eSDan McDonald _getcw(&cw); 40*5a172a1eSDan McDonald b->mode = cw; 41*5a172a1eSDan McDonald _getsw(&b->status); 42*5a172a1eSDan McDonald /* 43*5a172a1eSDan McDonald * set CW to... 44*5a172a1eSDan McDonald * RC (bits 10:11) 0 == round to nearest even 45*5a172a1eSDan McDonald * PC (bits 8:9) 2 == round to double 46*5a172a1eSDan McDonald * EM (bits 0:5) 0x3f == all exception trapping masked off 47*5a172a1eSDan McDonald */ 48*5a172a1eSDan McDonald cw = (cw & ~0xf3f) | 0x23f; 49*5a172a1eSDan McDonald _putcw(cw); 50*5a172a1eSDan McDonald } 51*5a172a1eSDan McDonald 52*5a172a1eSDan McDonald /* 53*5a172a1eSDan McDonald * Restores previous IEEE mode/status 54*5a172a1eSDan McDonald */ 55*5a172a1eSDan McDonald void 56*5a172a1eSDan McDonald __set_ieee_flags(__ieee_flags_type *b) { 57*5a172a1eSDan McDonald extern void _putcw(), _putsw(); 58*5a172a1eSDan McDonald 59*5a172a1eSDan McDonald _putcw(b->mode); 60*5a172a1eSDan McDonald _putsw(b->status); 61*5a172a1eSDan McDonald } 62