Exemplo n.º 1
0
static ERTS_INLINE int cmp_mon_ref(Eterm ref1, Eterm ref2) 
{
    Eterm *b1, *b2;


    b1 = boxed_val(ref1);
    b2 = boxed_val(ref2);
    if (is_ref_thing_header(*b1)) {
	if (is_ref_thing_header(*b2)) {
	    Uint32 *num1, *num2;
	    if (is_ordinary_ref_thing(b1)) {
		ErtsORefThing *rtp = (ErtsORefThing *) b1;
		num1 = rtp->num;
	    }
	    else {
		ErtsMRefThing *mrtp = (ErtsMRefThing *) b1;
		num1 = mrtp->mb->refn;
	    }
	    if (is_ordinary_ref_thing(b2)) {
		ErtsORefThing *rtp = (ErtsORefThing *) b2;
		num2 = rtp->num;
	    }
	    else {
		ErtsMRefThing *mrtp = (ErtsMRefThing *) b2;
		num2 = mrtp->mb->refn;
	    }
	    return erts_internal_ref_number_cmp(num1, num2);
	}
	return -1;
    }
    if (is_ref_thing_header(*b2)) {
	return 1;
    }
    return CMP(ref1,ref2);
}
Exemplo n.º 2
0
static ERTS_INLINE int cmp_mon_ref(Eterm ref1, Eterm ref2) 
{
    Eterm *b1, *b2;


    b1 = boxed_val(ref1);
    b2 = boxed_val(ref2);
    if (is_ref_thing_header(*b1)) {
	if (is_ref_thing_header(*b2)) {
	    return memcmp(b1+1,b2+1,ERTS_REF_WORDS*sizeof(Uint));
	}
	return -1;
    }
    if (is_ref_thing_header(*b2)) {
	return 1;
    }
    return CMP(ref1,ref2);
}