From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 14 May 2014 21:57:54 +0100 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d04138a252cb4d104f9626f2b Subject: Re: [9fans] ainc() 386/amd64 differences Topicbox-Message-UUID: e656dc1e-ead8-11e9-9d60-3106f5b1d025 --f46d04138a252cb4d104f9626f2b Content-Type: text/plain; charset=UTF-8 % cat ../port/ref.c #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" int incref(Ref *r) { int x; x = ainc(&r->ref); if(x <= 0) panic("incref pc=%#p", getcallerpc(&r)); return x; } int decref(Ref *r) { int x; x = adec(&r->ref); if(x < 0) panic("decref pc=%#p", getcallerpc(&r)); return x; } --f46d04138a252cb4d104f9626f2b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

=
% cat ../port/ref.c
#include &q= uot;u.h"
#include "../port/lib.h"
#inclu= de "mem.h"
#include "dat.h"= ;
#include "fns.h"

int
incref(Ref *r)
{
int x;

x =3D ainc(&r->re= f);
if(x <=3D 0)
panic("incref pc=3D%#p", get= callerpc(&r));
return x;
}

int
decref(Ref *r)
{
int x;

x =3D adec(&r->ref);
if(x < 0)
panic("decref pc=3D%#p", getcallerpc(&am= p;r));
return x;
}

--f46d04138a252cb4d104f9626f2b--