1#pragma once
 2
 3#include <limits.h>
 4
 5#ifdef __cplusplus
 6extern "C" {
 7#endif
 8
 9/*
10 * Architecture-specific definition of WORD type for use in bitmaps.
11 */
12
13#if (PTRDIFF_WIDTH == 32) && (UINT_WIDTH >= 32)
14
15    typedef uint32_t Word;
16#   define WORD_WIDTH  32
17#   define WORD_MAX    0xFFFF'FFFF
18
19#elif PTRDIFF_WIDTH == 64
20
21    // on 64-bit architecture Word is configurable with WORD_WIDTH, default is 64.
22
23#   if defined(WORD_WIDTH) && (WORD_WIDTH == 32)
24
25        typedef uint32_t Word;
26#       define WORD_WIDTH  32
27#       define WORD_MAX    0xFFFF'FFFF
28
29#   else
30        typedef uint64_t Word;
31#       define WORD_WIDTH  64
32#       define WORD_MAX    0xFFFF'FFFF'FFFF'FFFF
33
34#   endif
35
36#else
37#   error Cannot define architecture-specific stuff. Please revise.
38#endif
39
40
41#ifdef __cplusplus
42}
43#endif