lkml.org 
[lkml]   [2004]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] lib/libcrc32c
Date

Hi,

On Tuesday 30 of March 2004 19:32, Clay Haapala wrote:
> On Fri, 26 Mar 2004, James Morris outgrape:
> > These need to be rediffed against the latest Linus kernel.
> >
> > It may be better to wait until 2.6.5 comes out, so we don't have too
> > much new stuff going into the -rc kernels.
> >
> >
> > - James
>
> Rediffed they are! I see that the digest setkey() api is already part
> of -rc3, so because this code is a simple "add" and I will be
> on vacation next week when 2.6.5 might be cut, I am providing the
> patch now.
>
> This patch agains 2.6.5-rc3 kernel code implements the CRC32C
> algorithm. The routines are based on the same design as the
> existing CRC32 code. Licensing is intended to be identical (GPL).

+/*
+ * This is the CRC-32C table
+ * Generated with:
+ * width = 32 bits
+ * poly = 0x1EDC6F41
+ * reflect input bytes = true
+ * reflect output bytes = true
+ */
+
+static u32 crc32c_table[256] = {

Tables are build time generated in case of CRC32 (lib/gen_crc32table.c)
so you can trade some performance for smaller size of the table.

[ However I don't know how useful is this. ]

+/*EXPORT_SYMBOL(crc32c_be);*/
+
+#if CRC_BE_BITS == 1
+u32 attribute((pure))
+crc32_be(u32 crc, unsigned char const *p, size_t len)
+{
+ int i;
+ while (len--) {
+ crc ^= *p++ << 24;
+ for (i = 0; i < 8; i++)
+ crc =
+ (crc << 1) ^ ((crc & 0x80000000) ? CRC32C_POLY_BE :
+ 0);
+ }
+ return crc;
+}
+#endif

Is there any reason in adding crc32_be() until it is finished
(LE version) and/or needed?

Regards,
Bartlomiej

-
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: 2005-03-22 14:02    [W:1.862 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site