Ruby: ext/zlib/zlib-1.2.13/crc32.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions
crc32.c File Reference
`#include "zutil.h"`
`#include "crc32.h"`

Go to the source code of this file.

## Macros
#define | N 5
#define | W 4
#define | POLY 0xedb88320 /* p(x) reflected, with x^32 implied */

## Functions
z_crc_t multmodp | OF ((z_crc_t a, z_crc_t b))
z_crc_t x2nmodp | OF ((z_off64_t n, unsigned k))
z_crc_t | multmodp (z_crc_t a, z_crc_t b)
z_crc_t | x2nmodp (z_off64_t n, unsigned k)
const z_crc_t FAR *ZEXPORT | get_crc_table ()
unsigned long ZEXPORT | crc32_z (unsigned long crc, const unsigned char FAR *buf, z_size_t len)
unsigned long ZEXPORT | crc32 (unsigned long crc, const unsigned char FAR *buf, uInt len)
uLong ZEXPORT | crc32_combine64 (uLong crc1, uLong crc2, z_off64_t len2)
uLong ZEXPORT | crc32_combine (uLong crc1, uLong crc2, z_off_t len2)
uLong ZEXPORT | crc32_combine_gen64 (z_off64_t len2)
uLong ZEXPORT | crc32_combine_gen (z_off_t len2)
uLong ZEXPORT | crc32_combine_op (uLong crc1, uLong crc2, uLong op)

## Macro Definition Documentation

## ◆ N

#define N 5

Definition at line 57 of file crc32.c.

## ◆ POLY

#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */

Definition at line 150 of file crc32.c.

## ◆ W

#define W 4

Definition at line 85 of file crc32.c.

## Function Documentation

## ◆ crc32()

unsigned long ZEXPORT crc32 | ( | unsigned long | crc,
|  | const unsigned char FAR * | buf,
|  | uInt | len
| ) |  |

Definition at line 1072 of file crc32.c.

References crc32_z(), and len.

Referenced by deflate(), deflateResetKeep(), gunpipe(), gzinit(), gzscan(), gztack(), inflate(), log_append(), out(), read_buf(), unzReadCurrentFile(), zipCloseFileInZipRaw(), zipCloseFileInZipRaw64(), and zipWriteInFileInZip().

## ◆ crc32_combine()

uLong ZEXPORT crc32_combine | ( | uLong | crc1,
|  | uLong | crc2,
|  | z_off_t | len2
| ) |  |

Definition at line 1093 of file crc32.c.

References crc32_combine64(), and z_off64_t.

Referenced by gzcopy(), and gzip_normalize().

## ◆ crc32_combine64()

uLong ZEXPORT crc32_combine64 | ( | uLong | crc1,
|  | uLong | crc2,
|  | z_off64_t | len2
| ) |  |

Definition at line 1081 of file crc32.c.

References multmodp(), and x2nmodp().

Referenced by crc32_combine().

## ◆ crc32_combine_gen()

uLong ZEXPORT crc32_combine_gen | ( | z_off_t | len2 | ) |

Definition at line 1112 of file crc32.c.

References crc32_combine_gen64(), and z_off64_t.

## ◆ crc32_combine_gen64()

uLong ZEXPORT crc32_combine_gen64 | ( | z_off64_t | len2 | ) |

Definition at line 1102 of file crc32.c.

References x2nmodp().

Referenced by crc32_combine_gen().

## ◆ crc32_combine_op()

uLong ZEXPORT crc32_combine_op | ( | uLong | crc1,
|  | uLong | crc2,
|  | uLong | op
| ) |  |

Definition at line 1119 of file crc32.c.

References multmodp().

## ◆ crc32_z()

unsigned long ZEXPORT crc32_z | ( | unsigned long | crc,
|  | const unsigned char FAR * | buf,
|  | z_size_t | len
| ) |  |

Definition at line 748 of file crc32.c.

References crc_table, len, N, W, word0, word1, and Z_NULL.

Referenced by crc32().

## ◆ get_crc_table()

const z_crc_t FAR *ZEXPORT get_crc_table | ( |  | ) |

Definition at line 595 of file crc32.c.

References crc_table, and FAR.

Referenced by unzOpenCurrentFile3(), and zipOpenNewFileInZip4_64().

## ◆ multmodp()

z_crc_t multmodp | ( | z_crc_t | a,
|  | z_crc_t | b
| ) |  |

Definition at line 551 of file crc32.c.

References POLY.

Referenced by crc32_combine64(), crc32_combine_op(), and x2nmodp().

## ◆ OF() [1/2]

z_crc_t multmodp OF | ( | (z_crc_t a, z_crc_t b) |  | ) |

## ◆ OF() [2/2]

z_crc_t x2nmodp OF | ( | (z_off64_t n, unsigned k) |  | ) |

## ◆ x2nmodp()

z_crc_t x2nmodp | ( | z_off64_t | n,
|  | unsigned | k
| ) |  |

Definition at line 575 of file crc32.c.

References multmodp(), and x2n_table.

Referenced by crc32_combine64(), and crc32_combine_gen64().