1988-04-07 11:40:46 +00:00
|
|
|
/*
|
|
|
|
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
|
|
|
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1988-04-07 11:40:46 +00:00
|
|
|
|
1993-01-05 12:06:58 +00:00
|
|
|
# include "FP_types.h"
|
1988-04-07 10:57:49 +00:00
|
|
|
|
1993-01-05 12:06:58 +00:00
|
|
|
void
|
1988-04-07 10:57:49 +00:00
|
|
|
b64_sft(e1,n)
|
|
|
|
B64 *e1;
|
1988-07-25 10:46:15 +00:00
|
|
|
int n;
|
1988-04-07 10:57:49 +00:00
|
|
|
{
|
1988-08-03 23:31:40 +00:00
|
|
|
if (n > 0) {
|
1988-08-04 11:16:20 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
1988-08-03 23:31:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
n = -n;
|
|
|
|
if (n > 0) {
|
1988-08-04 11:16:20 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
1988-08-03 23:31:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1993-01-05 12:06:58 +00:00
|
|
|
void
|
1988-08-03 23:31:40 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1993-01-05 12:06:58 +00:00
|
|
|
void
|
1988-08-03 23:31:40 +00:00
|
|
|
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;
|
1988-04-07 10:57:49 +00:00
|
|
|
}
|