Doxygen Source Code Documentation
qbitbits.c File Reference
#include "f2c.h"
Go to the source code of this file.
Defines | |
#define | LONGBITS 32 |
#define | LONG8BITS (2*LONGBITS) |
Functions | |
integer | qbit_bits (longint a, integer b, integer len) |
longint | qbit_cshift (longint a, integer b, integer len) |
Define Documentation
|
Definition at line 8 of file qbitbits.c. Referenced by qbit_cshift(). |
|
Definition at line 4 of file qbitbits.c. |
Function Documentation
|
Definition at line 15 of file qbitbits.c. References a, L, and ulongint.
|
|
Definition at line 33 of file qbitbits.c. References a, LONG8BITS, and ulongint.
00035 { 00036 ulongint x, y, z; 00037 00038 x = (ulongint)a; 00039 if (len <= 0) { 00040 if (len == 0) 00041 return 0; 00042 goto full_len; 00043 } 00044 if (len >= LONG8BITS) { 00045 full_len: 00046 if (b >= 0) { 00047 b %= LONG8BITS; 00048 return (longint)(x << b | x >> LONG8BITS - b ); 00049 } 00050 b = -b; 00051 b %= LONG8BITS; 00052 return (longint)(x << LONG8BITS - b | x >> b); 00053 } 00054 y = z = (unsigned long)-1; 00055 y <<= len; 00056 z &= ~y; 00057 y &= x; 00058 x &= z; 00059 if (b >= 0) { 00060 b %= len; 00061 return (longint)(y | z & (x << b | x >> len - b)); 00062 } 00063 b = -b; 00064 b %= len; 00065 return (longint)(y | z & (x >> b | x << len - b)); 00066 } |