/*---------------------------------------------------------------------------+1| reg_convert.c |2| |3| Convert register representation. |4| |5| Copyright (C) 1992,1993,1994,1996,1997 |6| W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia |7| E-mail [email protected] |8| |9| |10+---------------------------------------------------------------------------*/1112#include "exception.h"13#include "fpu_emu.h"1415int FPU_to_exp16(FPU_REG const *a, FPU_REG *x)16{17int sign = getsign(a);1819*(long long *)&(x->sigl) = *(const long long *)&(a->sigl);2021/* Set up the exponent as a 16 bit quantity. */22setexponent16(x, exponent(a));2324if (exponent16(x) == EXP_UNDER) {25/* The number is a de-normal or pseudodenormal. */26/* We only deal with the significand and exponent. */2728if (x->sigh & 0x80000000) {29/* Is a pseudodenormal. */30/* This is non-80486 behaviour because the number31loses its 'denormal' identity. */32addexponent(x, 1);33} else {34/* Is a denormal. */35addexponent(x, 1);36FPU_normalize_nuo(x);37}38}3940if (!(x->sigh & 0x80000000)) {41EXCEPTION(EX_INTERNAL | 0x180);42}4344return sign;45}464748