From 2aa15abd131ca2e8bfd1a5a6fb5464c9d275cc7c Mon Sep 17 00:00:00 2001 From: Andrey Rys Date: Thu, 21 Mar 2019 16:42:27 +0700 Subject: [PATCH] Speed up on 64bit systems by using 64bit registers. --- machdefs.h | 19 +++++++++++++++++++ tfdef.h | 9 ++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 machdefs.h diff --git a/machdefs.h b/machdefs.h new file mode 100644 index 0000000..a99d0eb --- /dev/null +++ b/machdefs.h @@ -0,0 +1,19 @@ +#ifndef _MACHINE_DEFINITIONS_HEADER +#define _MACHINE_DEFINITIONS_HEADER + +#include +#include + +#undef MACHINE_16BIT +#undef MACHINE_32BIT +#undef MACHINE_64BIT + +#if UINTPTR_MAX == UINT32_MAX +#define MACHINE_32BIT +#elif UINTPTR_MAX == UINT64_MAX +#define MACHINE_64BIT +#elif UINTPTR_MAX == UINT16_MAX +#define MACHINE_16BIT +#endif + +#endif diff --git a/tfdef.h b/tfdef.h index 38b354c..017e55c 100644 --- a/tfdef.h +++ b/tfdef.h @@ -11,11 +11,18 @@ #include #include +#include "machdefs.h" +#if defined(MACHINE_64BIT) +#define TF_UNIT_TYPE uint64_t +#define TF_NR_BLOCK_BITS 256 +#define TF_NR_KEY_BITS 512 +#else #define TF_UNIT_TYPE uint32_t - #define TF_NR_BLOCK_BITS 128 #define TF_NR_KEY_BITS 256 +#endif + #define TF_NR_BLOCK_UNITS 4 #define TF_NR_KEY_UNITS 8