aboutsummaryrefslogtreecommitdiff
path: root/src/util/bits.c
diff options
context:
space:
mode:
authorJ08nY2025-03-20 16:22:28 +0100
committerJ08nY2025-03-20 16:22:47 +0100
commitefa899bab078ef57d55ffbde9343d1320a9b08a0 (patch)
tree0938d637fc389175c346e7e41057f71eb43638d6 /src/util/bits.c
parentce6f2ddbb6c1cd718f3e093e71eddb7ab4a69f07 (diff)
downloadecgen-efa899bab078ef57d55ffbde9343d1320a9b08a0.tar.gz
ecgen-efa899bab078ef57d55ffbde9343d1320a9b08a0.tar.zst
ecgen-efa899bab078ef57d55ffbde9343d1320a9b08a0.zip
Fix discriminant iteration in CM with composite order.
The prime impl is still broken. The family gen is as well.
Diffstat (limited to '')
-rw-r--r--src/util/bits.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/bits.c b/src/util/bits.c
index 0d60c26..b73a55d 100644
--- a/src/util/bits.c
+++ b/src/util/bits.c
@@ -174,16 +174,18 @@ char *bits_to_hex(const bits_t *bits) {
// else
// 0 0 | a b | c d | e
// ^-----^ (8-offset zero bits, offset bits from first byte)
- // ^-----^ (8-offset bits from first byte, offset bits from second byte)
+ // ^-----^ (8-offset bits from first byte, offset bits from second
+ // byte)
// ....
- // ^-----^ (8-offset bits from second to last byte, offset bits from last byte)
+ // ^-----^ (8-offset bits from second to last byte, offset bits
+ // from last byte)
for (size_t i = 0; i < BYTE_LEN(bits->bitlen); ++i) {
size_t pos = (i * 2) + (bits->sign ? 1 : 0);
unsigned char value;
if (offset) {
value = bits->bits[i] >> (8 - offset);
if (i != 0) {
- value |= (bits->bits[i-1] & ~(1 << (8 - offset))) << offset;
+ value |= (bits->bits[i - 1] & ~(1 << (8 - offset))) << offset;
}
} else {
value = bits->bits[i];