forked from ANSSI-FR/libecc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwords_32.h
54 lines (46 loc) · 1.3 KB
/
words_32.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright (C) 2017 - This file is part of libecc project
*
* Authors:
* Ryad BENADJILA <ryadbenadjila@gmail.com>
* Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr>
* Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr>
*
* Contributors:
* Nicolas VIVET <nicolas.vivet@ssi.gouv.fr>
* Karim KHALFALLAH <karim.khalfallah@ssi.gouv.fr>
*
* This software is licensed under a dual BSD and GPL v2 license.
* See LICENSE file at the root folder of the project.
*/
#ifndef __WORDS_32_H__
#define __WORDS_32_H__
/*
* Types for 32-bit long words and a few useful macros.
*/
#include "types.h"
typedef uint32_t word_t;
typedef uint16_t hword_t;
/* WORD_BITS (resp. WORD_BYTES): number of bits (resp. bytes) in a word. */
#define WORD_BITS (32)
#define WORD_BYTES (WORD_BITS / 8)
#define HWORD_BITS (16)
#define HWORD_BYTES (HWORD_BITS / 8)
/* WORD: constant of word-size. */
#define WORD(A) (UINT32_C(A))
#define HWORD(A) (UINT16_C(A))
/* WORD_MAX: maximal value of a word. */
#define WORD_MAX UINT32_MAX
#define HWORD_MAX UINT16_MAX
/* PRINTF_WORD_HEX_FMT: printf hex format string for word */
#ifndef PRIx16
#define PRIx16 "hx"
#endif
#ifndef PRIx32
#define PRIx32 "x"
#endif
#ifndef PRIx64
#define PRIx64 "llx"
#endif
#define PRINTF_WORD_HEX_FMT "%08" PRIx32
#endif /* __WORDS_32_H__ */