lkml.org 
[lkml]   [2009]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 01/10] crc-itu-t: add bit-reversed calculation
    On Mon,  1 Jun 2009 18:54:42 +0400
    Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:

    > From: Darren Salt <linux@youmustbejoking.demon.co.uk>
    >
    > ..
    >
    > static inline u16 crc_itu_t_byte(u16 crc, const u8 data)
    > {
    > return (crc << 8) ^ crc_itu_t_table[((crc >> 8) ^ data) & 0xff];
    > }
    >
    > +static inline u16 crc_itu_t_bitreversed_byte(u16 crc, const u8 data)
    > +{
    > + return (crc << 8) ^ crc_itu_t_table[((crc >> 8) ^ bitrev8(data)) & 0xff];
    > +}

    I suspect that inlining these was a mistake, but one which we make often.

    > #endif /* CRC_ITU_T_H */
    >
    > diff --git a/lib/crc-itu-t.c b/lib/crc-itu-t.c
    > index a63472b..5562fdd 100644
    > --- a/lib/crc-itu-t.c
    > +++ b/lib/crc-itu-t.c
    > @@ -64,6 +64,24 @@ u16 crc_itu_t(u16 crc, const u8 *buffer, size_t len)
    > }
    > EXPORT_SYMBOL(crc_itu_t);
    >
    > +/**
    > + * crc_itu_t_bitreversed - Compute the CRC-ITU-T for the data buffer;
    > + * the buffer content is assumed to be bit-reversed

    kerneldoc doesn't support the breaking of this information across
    multiple lines. It'll need to be done as a single 120-column line.


    > + * @crc: previous CRC value
    > + * @buffer: data pointer
    > + * @len: number of bytes in the buffer
    > + *
    > + * Returns the updated CRC value
    > + */
    > +u16 crc_itu_t_bitreversed(u16 crc, const u8 *buffer, size_t len)
    > +{
    > + while (len--)
    > + crc = crc_itu_t_bitreversed_byte(crc, *buffer++);
    > + return crc;
    > +}
    > +EXPORT_SYMBOL(crc_itu_t_bitreversed);



    \
     
     \ /
      Last update: 2009-06-04 02:07    [W:3.766 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site