forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshifter.fc
More file actions
executable file
·75 lines (70 loc) · 1.07 KB
/
Copy pathshifter.fc
File metadata and controls
executable file
·75 lines (70 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
# include "FP_types.h"
void
b64_sft(e1,n)
B64 *e1;
int n;
{
if (n > 0) {
if (n > 63) {
e1->l_32 = 0;
e1->h_32 = 0;
return;
}
if (n >= 32) {
e1->l_32 = e1->h_32;
e1->h_32 = 0;
n -= 32;
}
if (n > 0) {
e1->l_32 >>= n;
if (e1->h_32 != 0) {
e1->l_32 |= (e1->h_32 << (32 - n));
e1->h_32 >>= n;
}
}
return;
}
n = -n;
if (n > 0) {
if (n > 63) {
e1->l_32 = 0;
e1->h_32 = 0;
return;
}
if (n >= 32) {
e1->h_32 = e1->l_32;
e1->l_32 = 0;
n -= 32;
}
if (n > 0) {
e1->h_32 <<= n;
if (e1->l_32 != 0) {
e1->h_32 |= (e1->l_32 >> (32 - n));
e1->l_32 <<= n;
}
}
}
}
void
b64_lsft(e1)
B64 *e1;
{
/* shift left 1 bit */
e1->h_32 <<= 1;
if (e1->l_32 & 0x80000000L) e1->h_32 |= 1;
e1->l_32 <<= 1;
}
void
b64_rsft(e1)
B64 *e1;
{
/* shift right 1 bit */
e1->l_32 >>= 1;
if (e1->h_32 & 1) e1->l_32 |= 0x80000000L;
e1->h_32 >>= 1;
}