Sha256: 0613c1a3c4956781bdfd1e5049d72be801acbb33229e09fd4354c4ec88b6c74f
Contents?: true
Size: 681 Bytes
Versions: 5
Compression:
Stored size: 681 Bytes
Contents
#include "ruby.h" #include "extconf.h" #include "crc32_xfer.h" VALUE Digest_CRC32XFER_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32_xfer_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32_xfer_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32XFER = rb_const_get(mDigest, rb_intern("CRC32XFER")); rb_define_method(cCRC32XFER, "update", Digest_CRC32XFER_update, 1); }
Version data entries
5 entries across 5 versions & 1 rubygems