Speed up on 64bit systems by using 64bit registers.

This commit is contained in:
Andrey Rys 2019-03-21 16:42:27 +07:00
parent 76b80ded3a
commit 2aa15abd13
No known key found for this signature in database
GPG Key ID: ED732729967CDBC5
2 changed files with 27 additions and 1 deletions

19
machdefs.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef _MACHINE_DEFINITIONS_HEADER
#define _MACHINE_DEFINITIONS_HEADER
#include <stdint.h>
#include <limits.h>
#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

View File

@ -11,11 +11,18 @@
#include <stddef.h>
#include <stdint.h>
#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