60 g2int i, tbit, bitcnt, ibit, itmp;
62 static g2int ones[]={1, 3, 7, 15, 31, 63, 127, 255};
66 for (i = 0; i < n; i++)
71 nbit = nbit + nbyte + nskip;
74 tbit = (bitcnt < (8 - ibit)) ? bitcnt : 8 - ibit;
75 itmp = (int)*(in + index) & ones[7 - ibit];
76 if (tbit != 8 - ibit) itmp >>= (8 - ibit - tbit);
78 bitcnt = bitcnt - tbit;
83 itmp = itmp << 8 | (int)*(in + index);
91 itmp = ( itmp << bitcnt ) |
92 (((
int)*(in + index) >> (8 - bitcnt)) & ones[bitcnt - 1]);
117 g2int i, bitcnt, tbit, ibit, itmp, imask, itmp2, itmp3;
119 static g2int ones[]={1, 3, 7, 15, 31, 63, 127, 255};
123 nbit = iskip + nbyte - 1;
124 for (i = 0; i < n; i++)
130 nbit = nbit + nbyte + nskip;
135 tbit = (bitcnt < (ibit+1)) ? bitcnt : ibit + 1;
136 imask = ones[tbit - 1] << (7 - ibit);
137 itmp2 = (itmp << (7 - ibit)) & imask;
138 itmp3 = (int)*(out + index) & (255 - imask);
139 out[index] = (
unsigned char)(itmp2 | itmp3);
140 bitcnt = bitcnt - tbit;
149 out[index] = (
unsigned char)(itmp & 255);
158 itmp2 = itmp & ones[bitcnt - 1];
159 itmp3 = (int)*(out + index) & (255 - ones[bitcnt - 1]);
160 out[index] = (
unsigned char)(itmp2 | itmp3);
void gbit(unsigned char *in, g2int *iout, g2int iskip, g2int nbyte)
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each...
void sbit(unsigned char *out, g2int *in, g2int iskip, g2int nbyte)
Store bits - put arbitrary size values into a packed bit string, taking the low order bits from each ...
void gbits(unsigned char *in, g2int *iout, g2int iskip, g2int nbyte, g2int nskip, g2int n)
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each...
void sbits(unsigned char *out, g2int *in, g2int iskip, g2int nbyte, g2int nskip, g2int n)
Store bits - put arbitrary size values into a packed bit string, taking the low order bits from each ...
Header file for NCEPLIBS-g2c library.
int64_t g2int
Long integer type.