Solved
what this function does ?
Posted on 2004-04-27
hi all , hope all are well. i have been stuck for a long time in this code below. i am not understanding what these two function does . i remembered you people. you might help me to understand what this two function does. ok, let me write the code first.... then question.
code 1
---------
here is a function..........
#define BITS 12 // globally declared
input_code(FILE *input)
{
unsigned int return_value;
static int input_bit_count=0;
static unsigned long input_bit_buffer=0L;
while (input_bit_count <= 24)
{
input_bit_buffer |=
(unsigned long) getc(input) << (24-input_bit_count);
input_bit_count += 8;
}
return_value=input_bit_buffer >> (32-BITS);
input_bit_buffer <<= BITS;
input_bit_count -= BITS;
return(return_value);
}
question >> i want to know what this function does ? can you explain little bit.
code 2
---------
here is another function but RELATED........
output_code(FILE *output,unsigned int code)
{
static int output_bit_count=0;
static unsigned long output_bit_buffer=0L;
output_bit_buffer |= (unsigned long) code << (32-BITS-output_bit_count);
output_bit_count += BITS;
while (output_bit_count >= 8)
{
putc(output_bit_buffer >> 24,output);
output_bit_buffer <<= 8;
output_bit_count -= 8;
}
}
question >> i want to know what this function does ? can you explain little bit about this.
IN FACT these two are the two function of a sigle main code. i am just calling these two function.i dont understand what these two functions are are doing.
your input are valueable to me. any kind of help is highly appreciated. waiting for response.
thanking you