-
Notifications
You must be signed in to change notification settings - Fork 22
/
macros.h
executable file
·62 lines (47 loc) · 946 Bytes
/
macros.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
#ifndef MACROS_H
#define MACROS_H
#include <stdint.h>
#include <string.h>
#include "portable.h"
#define XCHG(x, y) (t) = (x); (x) = (y); (y) = (t);
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
typedef union _w16_t {
uint8_t b[2];
uint16_t w;
} w16_t;
typedef union _w32_t {
uint8_t b[4];
uint32_t w;
} w32_t;
typedef union _w64_t {
uint8_t b[8];
uint32_t w[2];
uint64_t q;
} w64_t;
typedef union _w128_t {
uint8_t b[16];
uint32_t w[4];
uint64_t q[2];
uint8_t m[4][4]; // matrix
} w128_t;
typedef union _w256_t {
uint8_t b[32];
uint32_t w[8];
uint64_t q[4];
} w256_t;
typedef union _w512_t {
uint8_t b[64];
uint32_t w[16];
uint64_t q[8];
} w512_t;
typedef union _w1024_t {
uint8_t b[128];
uint32_t w[32];
uint64_t q[16];
} w1024_t;
typedef union _w2048_t {
uint8_t b[256];
uint32_t w[64];
uint64_t q[32];
} w2048_t;
#endif