From dd0945a583bf0c83a28793c9f43716d46f4dfc39 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 27 Sep 2023 11:02:51 +0200 Subject: [PATCH] Remove needless 0 check. --- galois.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/galois.go b/galois.go index 6e5c3fe3..041ef505 100644 --- a/galois.go +++ b/galois.go @@ -62,8 +62,7 @@ var logTable = [fieldSize]byte{ /** * Inverse of the logarithm table. Maps integer logarithms - * to members of the field. There is no entry for 255 - * because the highest log is 254. + * to members of the field. Entry 255 is the same as entry 0 sue to mod 255. * * This table was generated by `go run gentables.go` * Table has been truncated to 256 bytes, since no lookups are bigger. @@ -892,10 +891,7 @@ func galOneOver(a byte) byte { if a == 0 { panic("Argument 'divisor' is 0") } - logResult := logTable[a] - if logResult != 0 { - logResult ^= 255 - } + logResult := logTable[a] ^ 255 return expTable[logResult] }