2001-04-10 05:04:59 +04:00
|
|
|
/*---------------------------------------------------------------------------+
|
|
|
|
| reg_norm.c |
|
2003-08-01 13:32:33 +04:00
|
|
|
| $Id: reg_norm.c,v 1.4 2003-08-01 09:32:33 sshwarts 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)
|
|
|
|
{
|
2003-08-01 13:32:33 +04:00
|
|
|
if (! (x->sigh & 0x80000000))
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2003-08-01 13:32:33 +04:00
|
|
|
if (x->sigh == 0)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2003-08-01 13:32:33 +04:00
|
|
|
if (x->sigl == 0)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2003-04-19 19:48:30 +04:00
|
|
|
x->exp = 0;
|
2001-04-10 05:04:59 +04:00
|
|
|
return TAG_Zero;
|
|
|
|
}
|
|
|
|
x->sigh = x->sigl;
|
|
|
|
x->sigl = 0;
|
|
|
|
x->exp -= 32;
|
|
|
|
}
|
2003-08-01 13:32:33 +04:00
|
|
|
while (!(x->sigh & 0x80000000))
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
x->sigh <<= 1;
|
2003-08-01 13:32:33 +04:00
|
|
|
if (x->sigl & 0x80000000)
|
2001-04-10 05:04:59 +04:00
|
|
|
x->sigh |= 1;
|
|
|
|
x->sigl <<= 1;
|
|
|
|
x->exp --;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
x->exp += bias;
|
|
|
|
|
|
|
|
return TAG_Valid;
|
|
|
|
}
|