Sha256: 2ebcac75fb12849ed1a5e4f71ef2bc96ff51a03d51155379d53e8c0b2729c0e3

Contents?: true

Size: 686 Bytes

Versions: 5

Compression:

Stored size: 686 Bytes

Contents

#include "ruby.h"
#include "extconf.h"

#include "crc12_3gpp.h"

VALUE Digest_CRC12_3GPP_update(VALUE self, VALUE data)
{
	VALUE crc_ivar_name = rb_intern("@crc");
	VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name);
	crc12_t crc = NUM2UINT(crc_ivar);

	const char *data_ptr = StringValuePtr(data);
	size_t length = RSTRING_LEN(data);

	crc = crc12_3gpp_update(crc,data_ptr,length);

	rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc));
	return self;
}

void Init_crc12_3gpp_ext()
{
	VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest"));
	VALUE cCRC12_3GPP = rb_const_get(mDigest, rb_intern("CRC12_3GPP"));

	rb_define_method(cCRC12_3GPP, "update", Digest_CRC12_3GPP_update, 1);
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
digest-crc-0.6.3 ext/digest/crc12_3gpp/crc12_3gpp_ext.c
digest-crc-0.6.2 ext/digest/crc12_3gpp/crc12_3gpp_ext.c
digest-crc-0.6.1 ext/digest/crc12_3gpp/crc12_3gpp_ext.c
digest-crc-0.6.0 ext/digest/crc12_3gpp/crc12_3gpp_ext.c
digest-crc-0.6.0.rc1 ext/digest/crc12_3gpp/crc12_3gpp_ext.c