Skip to content

Commit 9f7877f

Browse files
authored
[HashRecognize] Clarify hdr comment on GF(2^n) (NFC) (#157482)
Unify explanation for GF(2^n) and GF(2), which was previously convoluted.
1 parent 990fe80 commit 9f7877f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/lib/Analysis/HashRecognize.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
//
99
// The HashRecognize analysis recognizes unoptimized polynomial hash functions
1010
// with operations over a Galois field of characteristic 2, also called binary
11-
// fields, or GF(2^n): this class of hash functions can be optimized using a
12-
// lookup-table-driven implementation, or with target-specific instructions.
11+
// fields, or GF(2^n). 2^n is termed the order of the Galois field. This class
12+
// of hash functions can be optimized using a lookup-table-driven
13+
// implementation, or with target-specific instructions.
14+
//
1315
// Examples:
1416
//
1517
// 1. Cyclic redundancy check (CRC), which is a polynomial division in GF(2).
@@ -24,12 +26,10 @@
2426
//
2527
// c_m * x^m + c_(m-1) * x^(m-1) + ... + c_0 * x^0
2628
//
27-
// where each coefficient c is can take values in GF(2^n), where 2^n is termed
28-
// the order of the Galois field. For GF(2), each coefficient can take values
29-
// either 0 or 1, and the polynomial is simply represented by m+1 bits,
30-
// corresponding to the coefficients. The different variants of CRC are named by
31-
// degree of generating polynomial used: so CRC-32 would use a polynomial of
32-
// degree 32.
29+
// where each coefficient c is can take values 0 or 1. The polynomial is simply
30+
// represented by m+1 bits, corresponding to the coefficients. The different
31+
// variants of CRC are named by degree of generating polynomial used: so CRC-32
32+
// would use a polynomial of degree 32.
3333
//
3434
// The reason algorithms on GF(2^n) can be optimized with a lookup-table is the
3535
// following: in such fields, polynomial addition and subtraction are identical

0 commit comments

Comments
 (0)