From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtws5-0002xt-Pq for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:04:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xtwrz-0007di-Jj for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:04:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtwrz-0007dc-C0 for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:04:19 -0500 Message-ID: <1417086243.3722.26.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Thu, 27 Nov 2014 12:04:03 +0100 In-Reply-To: <5476EE1B.4090302@huawei.com> References: <1417079052-9372-1-git-send-email-kraxel@redhat.com> <5476EE1B.4090302@huawei.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RfC PATCH] hid: handle full ptr queues in post_load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gonglei Cc: "qemu-devel@nongnu.org" , "Dr. David Alan Gilbert" Hi, > > + evt = s->ptr.queue[(s->head+s->n) & QUEUE_MASK]; > > s->n is QUEUE_LENGTH, can we directly delete it? > evt = s->ptr.queue[s->head & QUEUE_MASK] I prefer to make clear in the code that we want the last ring element not the first and leave in the "+n", even if we could take it out. cheers, Gerd