/* * call-seq: * hash -> Fixnum * * Generates a Fixnum hash value for this object. * * */ DLL_LOCAL VALUE _getHash(VALUE self) { st_index_t h = rb_hash_start(0); h = rb_hash_uint(h, _self->GetWidth()); h = rb_hash_uint(h, _self->GetHeight()); if(_self->IsOk()) { //if(_self->GetType() == wxBITMAP_TYPE_INVALID) // return Qnil; char* data = (char*)_self->GetData(); if(data) h = rb_hash_uint(h, rb_str_hash(rb_str_new(data,_self->GetHeight() * _self->GetWidth() * 3))); if(_self->HasAlpha()) { h = rb_hash_uint(h, rb_str_hash(rb_str_new((char*) _self->GetAlpha(),_self->GetHeight() * _self->GetWidth()))); } unsigned char r,g,b; if(_self->GetOrFindMaskColour(&r,&g,&b)) { h = rb_hash_uint(h, r); h = rb_hash_uint(h, g); h = rb_hash_uint(h, b); } } h = rb_hash_end(h); return LONG2FIX(h); }
/* * call-seq: * hash -> Fixnum * * Generates a Fixnum hash value for this object. * * */ DLL_LOCAL VALUE _getHash(VALUE self) { st_index_t h = rb_hash_start(0); h = rb_hash_uint(h, _self->GetWidth()); h = rb_hash_uint(h, _self->GetHeight()); h = rb_hash_end(h); return RB_LONG2FIX(h); }
static VALUE method_line_hash(VALUE self) { st_index_t hash; RGeo_GeometryData* self_data; VALUE factory; self_data = RGEO_GEOMETRY_DATA_PTR(self); factory = self_data->factory; hash = rb_hash_start(0); hash = rgeo_geos_objbase_hash(factory, RGEO_FACTORY_DATA_PTR(factory)->globals->feature_line, hash); hash = rgeo_geos_coordseq_hash(self_data->geos_context, self_data->geom, hash); return LONG2FIX(rb_hash_end(hash)); }
VALUE layout_hash(MessageLayout* layout, void* storage) { upb_msg_field_iter it; st_index_t h = rb_hash_start(0); VALUE hash_sym = rb_intern("hash"); for (upb_msg_field_begin(&it, layout->msgdef); !upb_msg_field_done(&it); upb_msg_field_next(&it)) { const upb_fielddef* field = upb_msg_iter_field(&it); VALUE field_val = layout_get(layout, storage, field); h = rb_hash_uint(h, NUM2LONG(rb_funcall(field_val, hash_sym, 0))); } h = rb_hash_end(h); return INT2FIX(h); }
/* * call-seq: * hash -> Fixnum * * Generates a Fixnum hash value for this object. * * */ DLL_LOCAL VALUE _getHash(VALUE self) { st_index_t h = rb_hash_start(_self->IsOk()); h = rb_hash_uint(h, _self->GetPointSize()); h = rb_hash_uint(h, _self->GetFamily()); h = rb_hash_uint(h, _self->GetStyle()); h = rb_hash_uint(h, _self->GetWeight()); h = rb_hash_uint(h, _self->GetUnderlined()); h = rb_hash_uint(h, _self->GetStrikethrough()); h = rb_hash_uint(h, rb_str_hash(wrap(_self->GetFaceName()))); h = rb_hash_end(h); return RB_LONG2FIX(h); }
static VALUE range_hash(VALUE range) { st_index_t hash = EXCL(range); VALUE v; hash = rb_hash_start(hash); v = rb_hash(RANGE_BEG(range)); hash = rb_hash_uint(hash, NUM2LONG(v)); v = rb_hash(RANGE_END(range)); hash = rb_hash_uint(hash, NUM2LONG(v)); hash = rb_hash_uint(hash, EXCL(range) << 24); hash = rb_hash_end(hash); return LONG2FIX(hash); }
static VALUE recursive_hash(VALUE range, VALUE dummy, int recur) { st_index_t hash = EXCL(range); VALUE v; hash = rb_hash_start(hash); if (!recur) { v = rb_hash(RANGE_BEG(range)); hash = rb_hash_uint(hash, NUM2LONG(v)); v = rb_hash(RANGE_END(range)); hash = rb_hash_uint(hash, NUM2LONG(v)); } hash = rb_hash_uint(hash, EXCL(range) << 24); hash = rb_hash_end(hash); return LONG2FIX(hash); }
static VALUE rb_struct_hash(VALUE s) { long i, len; st_index_t h; VALUE n; const VALUE *ptr; h = rb_hash_start(rb_hash(rb_obj_class(s))); ptr = RSTRUCT_CONST_PTR(s); len = RSTRUCT_LEN(s); for (i = 0; i < len; i++) { n = rb_hash(ptr[i]); h = rb_hash_uint(h, NUM2LONG(n)); } h = rb_hash_end(h); return INT2FIX(h); }
static VALUE recursive_hash(VALUE s, VALUE dummy, int recur) { long i, len; st_index_t h; VALUE n, *ptr; h = rb_hash_start(rb_hash(rb_obj_class(s))); if (!recur) { ptr = RSTRUCT_PTR(s); len = RSTRUCT_LEN(s); for (i = 0; i < len; i++) { n = rb_hash(ptr[i]); h = rb_hash_uint(h, NUM2LONG(n)); } } h = rb_hash_end(h); return INT2FIX(h); }