forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnrm_ext.fc
More file actions
executable file
·50 lines (43 loc) · 1.07 KB
/
Copy pathnrm_ext.fc
File metadata and controls
executable file
·50 lines (43 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
/********************************************************/
/*
NORMALIZE an EXTENDED FORMAT NUMBER
*/
/********************************************************/
#include "FP_shift.h"
#include "FP_types.h"
void
nrm_ext(e1)
EXTEND *e1;
{
/* we assume that the mantissa != 0 */
/* if it is then just return */
/* to let it be a problem elsewhere */
/* THAT IS, The exponent is not set to */
/* zero. If we don't test here an */
/* infinite loop is generated when */
/* mantissa is zero */
if ((e1->m1 | e1->m2) == 0L)
return;
/* if top word is zero mov low word */
/* to top word, adjust exponent value */
if (e1->m1 == 0L) {
e1->m1 = e1->m2;
e1->m2 = 0L;
e1->exp -= 32;
}
if ((e1->m1 & NORMBIT) == 0) {
unsigned long l = ((unsigned long)NORMBIT >> 1);
int cnt = -1;
while (! (l & e1->m1)) {
l >>= 1;
cnt--;
}
e1->exp += cnt;
b64_sft(&(e1->mantissa), cnt);
}
}