Skip to content

Commit 6dfe1dd

Browse files
committed
paraphrase gf_log
1 parent 1ff7800 commit 6dfe1dd

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

aes256.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,12 @@ gf_alog(uint8_t x) /* calculate anti-logarithm gen 3 */
129129
static uint8_t
130130
gf_log(uint8_t x) /* calculate logarithm gen 3 */
131131
{
132-
uint8_t y, i = 0;
132+
uint8_t y = 1, i = 0;
133133

134134
if (0 != x) {
135-
for (i = 1, y = 1; i > 0; i++) {
135+
do {
136136
y ^= rj_xtime(y);
137-
if (y == x) {
138-
break;
139-
}
140-
}
137+
} while ((++i != 0xff) && (y != x));
141138
}
142139

143140
return i;

0 commit comments

Comments
 (0)