2001-04-10 05:04:59 +04:00
|
|
|
/*---------------------------------------------------------------------------+
|
|
|
|
| reg_norm.c |
|
2001-10-06 07:53:46 +04:00
|
|
|
| $Id: reg_norm.c,v 1.2 2001-10-06 03:53:46 bdenney Exp $
|
2001-04-10 05:04:59 +04:00
|
|
|
| |
|
|
|
|
| Copyright (C) 1992,1993,1994,1995,1997,1999 |
|
|
|
|
| W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
|
|
|
|
| Australia. E-mail billm@melbpc.org.au |
|
|
|
|
| |
|
|
|
|
| Normalize the value in a FPU_REG. |
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| Return value is the tag of the answer. |
|
|
|
|
| |
|
|
|
|
+---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "fpu_emu.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int FPU_normalize_nuo(FPU_REG *x, int bias)
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( ! (x->sigh & 0x80000000) )
|
|
|
|
{
|
|
|
|
if ( x->sigh == 0 )
|
|
|
|
{
|
|
|
|
if ( x->sigl == 0 )
|
|
|
|
{
|
|
|
|
x->exp = EXP_UNDER;
|
|
|
|
return TAG_Zero;
|
|
|
|
}
|
|
|
|
x->sigh = x->sigl;
|
|
|
|
x->sigl = 0;
|
|
|
|
x->exp -= 32;
|
|
|
|
}
|
|
|
|
while ( !(x->sigh & 0x80000000) )
|
|
|
|
{
|
|
|
|
x->sigh <<= 1;
|
|
|
|
if ( x->sigl & 0x80000000 )
|
|
|
|
x->sigh |= 1;
|
|
|
|
x->sigl <<= 1;
|
|
|
|
x->exp --;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
x->exp += bias;
|
|
|
|
|
|
|
|
return TAG_Valid;
|
|
|
|
}
|