From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-6.3 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 62F021FAAD for ; Mon, 30 Jan 2017 16:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932410AbdA3QM0 (ORCPT ); Mon, 30 Jan 2017 11:12:26 -0500 Received: from mout.gmx.net ([212.227.17.20]:55599 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753686AbdA3QMZ (ORCPT ); Mon, 30 Jan 2017 11:12:25 -0500 Received: from virtualbox ([37.201.192.48]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MUHbK-1cxynK3iFe-00Qymf; Mon, 30 Jan 2017 17:04:56 +0100 Date: Mon, 30 Jan 2017 17:04:56 +0100 (CET) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: =?UTF-8?Q?Ren=C3=A9_Scharfe?= cc: Git List , Junio C Hamano Subject: Re: [PATCH 4/5] diff: use SWAP macro In-Reply-To: <84944ecd-d14e-b5e9-7566-9ab2b68c02fb@web.de> Message-ID: References: <8ef4c833-45bd-6831-0683-6d01f30aa518@web.de> <84944ecd-d14e-b5e9-7566-9ab2b68c02fb@web.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1351472784-1485792296=:3469" X-Provags-ID: V03:K0:dYcY6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ce6b+tdTvA7SIkM0tG zUsz59B7cyX6uXv/HVrShfdqelhmQ== Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1351472784-1485792296=:3469 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Hi Ren=C3=A9, On Sat, 28 Jan 2017, Ren=C3=A9 Scharfe wrote: > Use the macro SWAP to exchange the value of pairs of variables instead > of swapping them manually with the help of a temporary variable. The > resulting code is shorter and easier to read. >=20 > The two cases were not transformed by the semantic patch swap.cocci > because it's extra careful and handles only cases where the types of all > variables are the same -- and here we swap two ints and use an unsigned > temporary variable for that. Nevertheless the conversion is safe, as > the value range is preserved with and without the patch. One way to make this more obvious would be to change the type to signed first, and then transform (which then would catch these cases too, right?). Ciao, Dscho --8323329-1351472784-1485792296=:3469--