lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 30 Apr 2008 11:19:31 -0700
From:	"Ray Lee" <ray@...rabbit.org>
To:	"Soumyadip Das Mahapatra" <dip_kernel@...oo.co.in>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Improved Swaping Method In sort.c

On Wed, Apr 30, 2008 at 11:09 AM, Soumyadip Das Mahapatra
<dip_kernel@...oo.co.in> wrote:
> Thanks Jan,
>  Actually it should be
>  static void u32_swap(void *a, void *b)
>  {
>     *(u32 *)b ^= *(u32 *)a;
>     *(u32 *)a ^= *(u32 *)b;
>     *(u32 *)b ^= *(u32 *)a;
>  }
>  But this code saves memory equaling two integers. What about that ?

The above prevents gcc from storing the intermediary in a register. So
you're trading fast register access for slow memory access.

Really, you shouldn't be prosing optimizations unless you do two
things: check the output of gcc (on at least one platform, but really
should be several), and include timings of before/after.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ