Method: Zlib.crc_table
- Defined in:
- zlib.c
.crc_table ⇒ Object
Returns the table for calculating CRC checksum as an array.
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
# File 'zlib.c', line 538
static VALUE
rb_zlib_crc_table(VALUE obj)
{
#if !defined(HAVE_TYPE_Z_CRC_T)
/* z_crc_t is defined since zlib-1.2.7. */
typedef unsigned long z_crc_t;
#endif
const z_crc_t *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;
}
|