More Re: its in the 3s.....

joe666boxer@y... joe666boxer at y...
Mon, 19 Nov 2001 00:52:29 -0000


--- In ExtractStream@y..., Dale Reed <daler@n...> wrote:
> 
> From Tyconvert:
> 
> unsigned long size = (((p[0]<<8) | p[1])<<4) | (p[2]>>4);
> 
> From SplitStream:
> 
> TyStream[i].size =
> (((unsigned int) buf[header_pos]) << 12) |
> (((unsigned int) buf[header_pos + 1]) << 4) |
> (((unsigned int) buf[header_pos + 2]) >> 4);
> 
> Anyone notice the subtle difference between the two? It would only
> matter if the first byte was non-zero. Wonder which is correct? :)
> 

That looks like a typo in tyconvert. the shifted bits from p[1] will overwrite the lower 4 bits of p[0], which can't be right. From Extractstream 0.3 (around line 169):

size = ((*p)[0]<<12 | (*p)[1])<<4 | ((*p)[2]>>4);

Joe