Fix offset calculation to avoid additive identity of the ring
Zero is not a part of the multiplicative group of the ring
This commit is contained in:
parent
4fc7f1d043
commit
c118454ea5
|
@ -17,7 +17,7 @@
|
|||
#define MAX_SOURCE_DEPTH 32
|
||||
|
||||
// Set initial offset to size to distinguish start and end
|
||||
#define FOR_OFFSET_PROBE(base, offset, index, size) for (int offset = (size) | 1, index = ((base) + offset) % (size); offset > 0; offset = (offset << 1L) % ((size) | 1), offset = offset == (size) ? (size) - 1 /* n * 2 = n - 1 (mod n + 1) */ : offset, index = ((base) + offset) % (size))
|
||||
#define FOR_OFFSET_PROBE(base, offset, index, size) for (int offset = 0, index = (base) % (size); offset >= 0; offset = ((offset + 1) << 1L) % (((size) + 1) | 1) - 1, offset = offset == (size) ? (size) - 1 /* n * 2 = n - 1 (mod n + 1) */ : offset, index = ((base) + offset) % (size))
|
||||
|
||||
struct msg_target {
|
||||
FILE *file_handle;
|
||||
|
|
Loading…
Reference in New Issue