Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932489AbbD0Juy (ORCPT ); Mon, 27 Apr 2015 05:50:54 -0400 Received: from mail.bmw-carit.de ([62.245.222.98]:48669 "EHLO mail.bmw-carit.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932122AbbD0Juv (ORCPT ); Mon, 27 Apr 2015 05:50:51 -0400 X-CTCH-RefID: str=0001.0A0C0204.553E0677.0331,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Message-ID: <553E0677.3040107@bmw-carit.de> Date: Mon, 27 Apr 2015 11:50:47 +0200 From: Daniel Wagner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Rasmus Villemoes CC: Andrew Morton , Subject: Re: [PATCH] lib/sort: Add 64 bit swap function References: <1430119606-25012-1-git-send-email-daniel.wagner@bmw-carit.de> <87k2wyypyp.fsf@rasmusvillemoes.dk> In-Reply-To: <87k2wyypyp.fsf@rasmusvillemoes.dk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1612 Lines: 53 Hi Rasmus, On 04/27/2015 09:45 AM, Rasmus Villemoes wrote: > On Mon, Apr 27 2015, Daniel Wagner wrote: > >> static int cmp_32(const void *a, const void *b) >> { >> return (int) (*(u32 *)a - *(u32 *)b); >> } >> >> static int cmp_64(const void *a, const void *b) >> { >> return (int) (*(u64 *)a - *(u64 *)b); >> } >> > > Please [1] don't [2] do [3] this [4]. > > [1] acbbe6fbb240a927ee1f5994f04d31267d422215 kcmp: fix standard comparison bug > > [2] ef17af2a817db97d42dd2ec0a425231748e23dbc fs: nfsd: Fix signedness bug in compare_blob > > [3] ddbc22e27e672b6b180757ea1d7f8481dbb88128 fs/hfs/catalog.c: fix comparison bug in hfs_cat_keycmp > > [4] 72392ed0eb6fde96826cb9d66bd4f50a7ba61450 kernfs: Fix kernfs_name_compare > > (sorry for not actually looking at the patch - this just triggered one > of my pet peeves). Thanks for the pointers. I see, even the simplest stuff is not that simple. I'll keep an eye open for this one :) In this case though it is not so bad. You are looking at test code. I used that one to test the performance of the patch not the correctness since there is the boot-time regression test for the sorting. The main part of this path is a new u64 swap function: +static void u64_swap(void *a, void *b, int size) +{ + u64 t = *(u64 *)a; + *(u64 *)a = *(u64 *)b; + *(u64 *)b = t; +} + cheers, daniel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/