From patchwork Mon Jul 15 13:51:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 11044155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5FCF06C5 for ; Mon, 15 Jul 2019 13:52:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C7AC26E47 for ; Mon, 15 Jul 2019 13:52:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FF2F284F0; Mon, 15 Jul 2019 13:52:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5DAB26E47 for ; Mon, 15 Jul 2019 13:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732154AbfGONvx (ORCPT ); Mon, 15 Jul 2019 09:51:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42708 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731103AbfGONvv (ORCPT ); Mon, 15 Jul 2019 09:51:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A74BE3082B07; Mon, 15 Jul 2019 13:51:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6C215D705; Mon, 15 Jul 2019 13:51:45 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , kvm@vger.kernel.org, Juan Quintela , Thomas Huth , Richard Henderson , Laurent Vivier , "Dr. David Alan Gilbert" , Wei Yang Subject: [PULL 05/21] cutils: remove one unnecessary pointer operation Date: Mon, 15 Jul 2019 15:51:09 +0200 Message-Id: <20190715135125.17770-6-quintela@redhat.com> In-Reply-To: <20190715135125.17770-1-quintela@redhat.com> References: <20190715135125.17770-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 15 Jul 2019 13:51:50 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yang Since we will not operate on the next address pointed by out, it is not necessary to do addition on it. After removing the operation, the function size reduced 16/18 bytes. Signed-off-by: Wei Yang Reviewed-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Message-Id: <20190610030852.16039-2-richardw.yang@linux.intel.com> Signed-off-by: Juan Quintela --- util/cutils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/cutils.c b/util/cutils.c index dfc605f1ef..fd591cadf0 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -756,11 +756,11 @@ int uleb128_encode_small(uint8_t *out, uint32_t n) { g_assert(n <= 0x3fff); if (n < 0x80) { - *out++ = n; + *out = n; return 1; } else { *out++ = (n & 0x7f) | 0x80; - *out++ = n >> 7; + *out = n >> 7; return 2; } } @@ -768,7 +768,7 @@ int uleb128_encode_small(uint8_t *out, uint32_t n) int uleb128_decode_small(const uint8_t *in, uint32_t *n) { if (!(*in & 0x80)) { - *n = *in++; + *n = *in; return 1; } else { *n = *in++ & 0x7f; @@ -776,7 +776,7 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n) if (*in & 0x80) { return -1; } - *n |= *in++ << 7; + *n |= *in << 7; return 2; } }