lkml.org 
[lkml]   [2007]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] LZO1X de/compression support
Hi,

On 5/18/07, Andrey Panin <pazke@donpac.ru> wrote:
> On 138, 05 18, 2007 at 03:28:31PM +0530, Nitin Gupta wrote:
> > + register const unsigned char *ip;
>
> register keyword is meaningless for today's compiler.

But can we assume that gcc is being used? What if we use compiler for
which it does matter (can't give example for this...)?

>
> > + unsigned char *op;
> > + const unsigned char * const in_end = in + in_len;
> > + const unsigned char * const ip_end = in + in_len - M2_MAX_LEN - 5;
> > + const unsigned char *ii;
> > + const unsigned char ** const dict = (const unsigned char **)workmem;
> > +
> > + op = out;
>
> Why not write this as `unsigned char *op = out;` ?
>

Done.

> Empty if() body ?

No empty if() now.

> > + m_off -= 0x4000;
>
> What's this magic number 0x4000 repeated everywhere ? M3_MAX_OFFSET perhaps ?

I don't know :)

> > +#if defined(__LITTLE_ENDIAN)
> > + m_pos = op - 1;
> > + m_pos -= (*(const unsigned short *)ip) >> 2;
> > +#else
> > + m_pos = op - 1;
> > + m_pos -= (ip[0] >> 2) + (ip[1] << 6);
> > +#endif
>
> IMHO you could write it this way:
>
> m_pos = op - 1 - (le16_to_cpu(*(const u16 *)ip) >> 2);
>

Shouldn't this be cpu_to_le16() ?


> > +#if defined(__LITTLE_ENDIAN)
> > + m_pos -= (*(const unsigned short *)ip) >> 2;
> > +#else
> > + m_pos -= (ip[0] >> 2) + (ip[1] << 6);
> > +#endif
>
> m_pos -= le16_to_cpu(*(const u16 *)ip) >> 2;

cpu_to_le16() ?


---
Can you please snip-out irrelevant code parts. It is real pain for
eyes to sneek out your comments otherwise :)


Thanks for your comments.


Cheers,
Nitin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-05-22 11:11    [W:0.093 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site