Uninitialized vector entry?
[minix3.git] / lib / float / shifter.c
blob089da20c289e5650ea377b511307b7462c802430
1 /*
2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
6 /* $Header$ */
8 # include "FP_types.h"
10 void
11 b64_sft(e1,n)
12 B64 *e1;
13 int n;
15 if (n > 0) {
16 if (n > 63) {
17 e1->l_32 = 0;
18 e1->h_32 = 0;
19 return;
21 if (n >= 32) {
22 e1->l_32 = e1->h_32;
23 e1->h_32 = 0;
24 n -= 32;
26 if (n > 0) {
27 e1->l_32 >>= n;
28 if (e1->h_32 != 0) {
29 e1->l_32 |= (e1->h_32 << (32 - n));
30 e1->h_32 >>= n;
33 return;
35 n = -n;
36 if (n > 0) {
37 if (n > 63) {
38 e1->l_32 = 0;
39 e1->h_32 = 0;
40 return;
42 if (n >= 32) {
43 e1->h_32 = e1->l_32;
44 e1->l_32 = 0;
45 n -= 32;
47 if (n > 0) {
48 e1->h_32 <<= n;
49 if (e1->l_32 != 0) {
50 e1->h_32 |= (e1->l_32 >> (32 - n));
51 e1->l_32 <<= n;
57 void
58 b64_lsft(e1)
59 B64 *e1;
61 /* shift left 1 bit */
62 e1->h_32 <<= 1;
63 if (e1->l_32 & 0x80000000L) e1->h_32 |= 1;
64 e1->l_32 <<= 1;
67 void
68 b64_rsft(e1)
69 B64 *e1;
71 /* shift right 1 bit */
72 e1->l_32 >>= 1;
73 if (e1->h_32 & 1) e1->l_32 |= 0x80000000L;
74 e1->h_32 >>= 1;