move type checks to mode/types.h

Moving the type checks avoid the need for conditional compilation. This
also allows simplifying some include file dependencies.

Signed-off-by: Axel Heider <axelheider@gmx.de>
This commit is contained in:
Axel Heider 2021-09-27 14:57:32 +02:00 committed by Kent McLeod
parent 77fb21aa90
commit ee7a52d927
6 changed files with 18 additions and 14 deletions

View file

@ -6,6 +6,10 @@
#pragma once
#include <assert.h>
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
#define wordRadix 5
#define wordBits (1 << wordRadix)

View file

@ -6,6 +6,10 @@
#pragma once
#include <assert.h>
compile_assert(long_is_64bits, sizeof(unsigned long) == 8)
#define wordRadix 6
#define wordBits (1 << wordRadix)

View file

@ -7,15 +7,9 @@
#pragma once
#include <config.h>
#include <assert.h>
#include <mode/types.h>
#include <stdint.h>
#if defined(CONFIG_ARCH_AARCH32)
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
#elif defined(CONFIG_ARCH_AARCH64)
compile_assert(long_is_64bits, sizeof(unsigned long) == 8)
#endif
typedef unsigned long word_t;
typedef signed long sword_t;
/* for printf() formatting */

View file

@ -6,5 +6,9 @@
#pragma once
#include <assert.h>
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
#define wordRadix 5
#define wordBits (1 << wordRadix)

View file

@ -6,5 +6,9 @@
#pragma once
#include <assert.h>
compile_assert(long_is_64bits, sizeof(unsigned long) == 8)
#define wordRadix 6
#define wordBits (1 << wordRadix)

View file

@ -7,15 +7,9 @@
#pragma once
#include <config.h>
#include <assert.h>
#include <mode/types.h>
#include <stdint.h>
#if defined(CONFIG_ARCH_IA32)
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
#elif defined(CONFIG_ARCH_X86_64)
compile_assert(long_is_64bits, sizeof(unsigned long) == 8)
#endif
typedef unsigned long word_t;
typedef signed long sword_t;
/* for printf() formatting */