1 /* contrib/ltree/crc32.c */
4 * Implements CRC-32, as used in ltree.
6 * Note that the CRC is used in the on-disk format of GiST indexes, so we
7 * must stay backwards-compatible!
12 #include <sys/types.h>
14 #include <sys/types.h>
18 #define TOLOWER(x) tolower((unsigned char) (x))
20 #define TOLOWER(x) (x)
23 #include "utils/pg_crc.h"
27 ltree_crc32_sz(char *buf, int size)
32 INIT_TRADITIONAL_CRC32(crc);
35 char c = (char) TOLOWER(*p);
36 COMP_TRADITIONAL_CRC32(crc, &c, 1);
40 FIN_TRADITIONAL_CRC32(crc);
41 return (unsigned int) crc;