Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

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

#define LONG8BITS   (2*LONGBITS)
 

Definition at line 8 of file qbitbits.c.

Referenced by qbit_cshift().

#define LONGBITS   32
 

Definition at line 4 of file qbitbits.c.


Function Documentation

integer qbit_bits longint    a,
integer    b,
integer    len
 

Definition at line 15 of file qbitbits.c.

References a, L, and ulongint.

00017 {
00018         /* Assume 2's complement arithmetic */
00019 
00020         ulongint x, y;
00021 
00022         x = (ulongint) a;
00023         y = (ulongint)-1L;
00024         x >>= b;
00025         y <<= len;
00026         return (longint)(x & y);
00027         }

longint qbit_cshift longint    a,
integer    b,
integer    len
 

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         }
 

Powered by Plone

This site conforms to the following standards: