From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzi1I-0006Cz-C9 for qemu-devel@nongnu.org; Tue, 11 Sep 2018 08:43:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzi1C-0008Pf-N2 for qemu-devel@nongnu.org; Tue, 11 Sep 2018 08:43:51 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:35019) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fzi1A-0008D3-Pd for qemu-devel@nongnu.org; Tue, 11 Sep 2018 08:43:45 -0400 Received: by mail-pg1-x543.google.com with SMTP id 7-v6so12224094pgf.2 for ; Tue, 11 Sep 2018 05:43:41 -0700 (PDT) Sender: Richard Henderson References: <20180910232752.31565-1-cota@braap.org> <20180910232752.31565-3-cota@braap.org> From: Richard Henderson Message-ID: Date: Tue, 11 Sep 2018 05:43:38 -0700 MIME-Version: 1.0 In-Reply-To: <20180910232752.31565-3-cota@braap.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 02/12] util: add atomic64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Crosthwaite , Eduardo Habkost , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Murilo Opsfelder Araujo On 09/10/2018 04:27 PM, Emilio G. Cota wrote: > +#define GEN_READ(name, type) \ > + type name(const type *ptr) \ > + { \ > + QemuSpin *lock = addr_to_lock(ptr); \ > + type ret; \ > + \ > + qemu_spin_lock(lock); \ > + ret = *ptr; \ > + qemu_spin_unlock(lock); \ > + return ret; \ > + } > + > +GEN_READ(atomic_read_i64, int64_t) > +GEN_READ(atomic_read_u64, uint64_t) Is there really a good reason to have two external functions instead of having one of them inline and perform a cast? Is this any better than using libatomic? r~