[PATCH 1/2] Optimize buffer xoring.

Werner Koch wk at gnupg.org
Thu Nov 29 18:50:48 CET 2012


On Thu, 29 Nov 2012 16:37, jussi.kivilinna at mbnet.fi said:

> +#ifndef G10_BUFHELP_H
> +#define G10_BUFHELP_H
> +
> +#include <stdint.h>

You may only use stdint.h if it is available; see for example sha1.c.
We are targeting C90 and not C99.

> +#if defined(__i386__) || defined(__x86_64__)
> +/* These architechtures are able of unaligned memory accesses and can
> +   handle those fast.
> + */

Really?  All of them?

> +  ldst = (long *)dst;
> +  lsrc1 = (const long *)src1;
> +  lsrc2 = (const long *)src2;

You assume sizeof(long)<=sizeof(void*) - that should be okay.  However
this is only optimal on Unix systems where sizeof(long)== sizeof(void*);
Windows 64 bit has sizeof(long long)==sizeof(void*).  Thus tehre should
be some space for further improvement.


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gcrypt-devel mailing list