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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//! Global state. Per lfs.h lfs_gstate_t and lfs.c lfs_gstate_*.
use crate;
use cratelfs_block_t;
use cratelfs_pair_cmp;
use crate;
/// Per lfs.h typedef struct lfs_gstate (lines 429-432)
///
/// C:
/// ```c
/// typedef struct lfs_gstate {
/// uint32_t tag;
/// lfs_block_t pair[2];
/// } lfs_gstate_t;
/// ```
/// Per lfs.c lfs_gstate_xor (lines 407-412)
///
/// C:
/// ```c
/// static inline void lfs_gstate_xor(lfs_gstate_t *a, const lfs_gstate_t *b) {
/// a->tag ^= b->tag;
/// a->pair[0] ^= b->pair[0];
/// a->pair[1] ^= b->pair[1];
/// }
/// ```
/// Per lfs.c lfs_gstate_iszero (lines 413-418)
///
/// C:
/// ```c
/// static inline bool lfs_gstate_iszero(const lfs_gstate_t *a) {
/// return a->tag == 0 && a->pair[0] == 0 && a->pair[1] == 0;
/// }
/// ```
/// Per lfs.c lfs_gstate_hasorphans (lines 420-422)
///
/// C:
/// ```c
/// static inline bool lfs_gstate_hasorphans(const lfs_gstate_t *a) {
/// return lfs_tag_size(a->tag);
/// }
/// ```
/// Per lfs.c lfs_gstate_getorphans (lines 424-426)
///
/// C:
/// ```c
/// static inline uint8_t lfs_gstate_getorphans(const lfs_gstate_t *a) {
/// return lfs_tag_size(a->tag) & 0x1ff;
/// }
/// ```
/// Per lfs.c lfs_gstate_hasmove (lines 428-430)
///
/// C:
/// ```c
/// static inline bool lfs_gstate_hasmove(const lfs_gstate_t *a) {
/// return lfs_tag_type1(a->tag);
/// }
/// ```
/// Per lfs.c lfs_gstate_needssuperblock (lines 433-435)
///
/// C:
/// ```c
/// static inline bool lfs_gstate_needssuperblock(const lfs_gstate_t *a) {
/// return lfs_tag_size(a->tag) >> 9;
/// }
/// ```
/// Per lfs.c lfs_gstate_hasmovehere (lines 437-440)
///
/// C:
/// ```c
/// static inline bool lfs_gstate_hasmovehere(const lfs_gstate_t *a,
/// const lfs_block_t *pair) {
/// return lfs_tag_type1(a->tag) && lfs_pair_cmp(a->pair, pair) == 0;
/// }
/// ```
/// Per lfs.c lfs_gstate_fromle32 (lines 442-446)
///
/// C:
/// ```c
/// static inline void lfs_gstate_fromle32(lfs_gstate_t *a) {
/// a->tag = lfs_fromle32(a->tag);
/// a->pair[0] = lfs_fromle32(a->pair[0]);
/// a->pair[1] = lfs_fromle32(a->pair[1]);
/// }
/// ```
/// Per lfs.c lfs_gstate_tole32 (lines 449-453)
///
/// C:
/// ```c
/// static inline void lfs_gstate_tole32(lfs_gstate_t *a) {
/// a->tag = lfs_tole32(a->tag);
/// a->pair[0] = lfs_tole32(a->pair[0]);
/// a->pair[1] = lfs_tole32(a->pair[1]);
/// }
/// ```