Method: Zstdlib.crc_table
- Defined in:
- ext/zstdlib_c/ruby/zlib-3.3/zstdlib.c
.crc_table ⇒ Object
Returns the table for calculating CRC checksum as an array.
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
# File 'ext/zstdlib_c/ruby/zlib-3.3/zstdlib.c', line 552
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;
}
|