Re: [RFC] LZO1X de/compression support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 5/18/07, Andrey Panin <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux