Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more
GZIP_SUPPORT
Calculates Adler-32 checksum for string
, and returns updated
value of adler
. If string
is omitted, it returns
the Adler-32 initial value. If adler
is omitted, it assumes
that the initial value is given to adler
.
FIXME: expression.
static VALUE rb_zlib_adler32(int argc, VALUE *argv, VALUE klass) { return do_checksum(argc, argv, adler32); }
Combine two Adler-32 check values in to one. alder1
is the
first Adler-32 value, adler2
is the second Adler-32 value.
len2
is the length of the string used to generate
adler2
.
static VALUE rb_zlib_adler32_combine(VALUE klass, VALUE adler1, VALUE adler2, VALUE len2) { return ULONG2NUM( adler32_combine(NUM2ULONG(adler1), NUM2ULONG(adler2), NUM2LONG(len2))); }
Calculates CRC checksum for string
, and returns updated value
of crc
. If string
is omitted, it returns the CRC
initial value. If crc
is omitted, it assumes that the initial
value is given to crc
.
FIXME: expression.
static VALUE rb_zlib_crc32(int argc, VALUE *argv, VALUE klass) { return do_checksum(argc, argv, crc32); }
Combine two CRC-32 check values in to one. crc1
is the first
CRC-32 value, crc2
is the second CRC-32 value.
len2
is the length of the string used to generate
crc2
.
static VALUE rb_zlib_crc32_combine(VALUE klass, VALUE crc1, VALUE crc2, VALUE len2) { return ULONG2NUM( crc32_combine(NUM2ULONG(crc1), NUM2ULONG(crc2), NUM2LONG(len2))); }
Returns the table for calculating CRC checksum as an array.
static VALUE rb_zlib_crc_table(VALUE obj) { const unsigned long *crctbl; VALUE dst; int i; crctbl = get_crc_table(); dst = rb_ary_new2(256); for (i = 0; i < 256; i++) { rb_ary_push(dst, rb_uint2inum(crctbl[i])); } return dst; }