Automatic date update in version.in
[deliverable/binutils-gdb.git] / libiberty / crc32.c
index 2171a3d1c7fbe9e7611fafdc36310b1c57a7c569..96b12b9b56a720b652dcd11ebd4d5a80b10cccc1 100644 (file)
@@ -1,5 +1,5 @@
 /* crc32.c
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This file is part of the libiberty library.
 
 
 #include "libiberty.h"
 
-/* This table was generated by the following program.  This matches
-   what gdb does.
+/* This table was generated by the following program.
 
    #include <stdio.h>
 
    int
    main ()
    {
-     int i, j;
+     unsigned int i, j;
      unsigned int c;
      int table[256];
 
@@ -138,24 +137,37 @@ static const unsigned int crc32_table[] =
 
 /*
 
-@deftypefn Extension unsigned int crc32 (const unsigned char *@var{buf}, int @var{len}, unsigned int @var{init})
+@deftypefn Extension {unsigned int} crc32 (const unsigned char *@var{buf}, @
+  int @var{len}, unsigned int @var{init})
 
 Compute the 32-bit CRC of @var{buf} which has length @var{len}.  The
 starting value is @var{init}; this may be used to compute the CRC of
 data split across multiple buffers by passing the return value of each
 call as the @var{init} parameter of the next.
 
-This is intended to match the CRC used by the @command{gdb} remote
-protocol for the @samp{qCRC} command.  In order to get the same
-results as gdb for a block of data, you must pass the first CRC
-parameter as @code{0xffffffff}.
+This is used by the @command{gdb} remote protocol for the @samp{qCRC}
+command.  In order to get the same results as gdb for a block of data,
+you must pass the first CRC parameter as @code{0xffffffff}.
+
+This CRC can be specified as:
+
+  Width  : 32
+  Poly   : 0x04c11db7
+  Init   : parameter, typically 0xffffffff
+  RefIn  : false
+  RefOut : false
+  XorOut : 0
+
+This differs from the "standard" CRC-32 algorithm in that the values
+are not reflected, and there is no final XOR value.  These differences
+make it easy to compose the values of multiple blocks.
 
 @end deftypefn
 
 */
 
 unsigned int
-crc32 (const unsigned char *buf, int len, unsigned int init)
+xcrc32 (const unsigned char *buf, int len, unsigned int init)
 {
   unsigned int crc = init;
   while (len--)
This page took 0.024734 seconds and 4 git commands to generate.