forked from ANSSI-FR/libecc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwords_16.h
64 lines (55 loc) · 1.42 KB
/
words_16.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
55
56
57
58
59
60
61
62
63
64
/*
* Copyright (C) 2017 - This file is part of libecc project
*
* Authors:
* Ryad BENADJILA <[email protected]>
* Arnaud EBALARD <[email protected]>
* Jean-Pierre FLORI <[email protected]>
*
* Contributors:
* Nicolas VIVET <[email protected]>
* Karim KHALFALLAH <[email protected]>
*
* This software is licensed under a dual BSD and GPL v2 license.
* See LICENSE file at the root folder of the project.
*/
#ifndef __WORDS_16_H__
#define __WORDS_16_H__
/*
* Types for 16-bit long words and a few useful macros.
*/
#include "types.h"
typedef uint16_t word_t;
typedef uint8_t hword_t;
/* WORD_BITS (resp. WORD_BYTES): number of bits (resp. bytes) in a word. */
#define WORD_BITS (16)
#define WORD_BYTES (WORD_BITS / 8)
#define HWORD_BITS (8)
#define HWORD_BYTES (HWORD_BITS / 8)
/* WORD: constant of word-size. */
#define WORD(A) (UINT16_C(A))
#define HWORD(A) (UINT8_C(A))
/* WORD_MAX: maximal value of a word. */
#define WORD_MAX UINT16_MAX
#define HWORD_MAX UINT8_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 "%04" PRIx16
#ifndef PRIu16
#define PRIu16 "hu"
#endif
#ifndef PRIu32
#define PRIu32 "u"
#endif
#ifndef PRIu64
#define PRIu64 "llu"
#endif
#endif /* __WORDS_16_H__ */