Skip to content

Commit 20e802d

Browse files
zfoggclaude
authored andcommitted
trigger ci
1 parent cb831eb commit 20e802d

2 files changed

Lines changed: 36 additions & 41 deletions

File tree

src/boolean.c

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,57 @@
22

33
// Test if a binary number is zero.
44
bool binEQZero(const bin x) {
5-
for (bin_int_t i = 0; i < BIN_BITS; i++) {
6-
if (x.bits[i])
7-
return false;
8-
}
9-
return true;
5+
for (bin_int_t i = 0; i < BIN_BITS; i++) {
6+
if (x.bits[i])
7+
return false;
8+
}
9+
return true;
1010
}
1111

1212
// Test if a binary number is one.
1313
bool binEQOne(const bin x) {
14-
// Check if the least significant bit is 1 and all others are 0
15-
if (!x.bits[0])
16-
return false;
17-
for (bin_int_t i = 1; i < BIN_BITS; i++) {
18-
if (x.bits[i])
19-
return false;
20-
}
21-
return true;
14+
// Check if the least significant bit is 1 and all others are 0
15+
if (!x.bits[0])
16+
return false;
17+
for (bin_int_t i = 1; i < BIN_BITS; i++) {
18+
if (x.bits[i])
19+
return false;
20+
}
21+
return true;
2222
}
2323

2424
// Test if a binary number is the maximum value.
2525
bool binEQMax(const bin x) {
26-
for (bin_int_t i = 0; i < BIN_BITS; i++) {
27-
if (!x.bits[i])
28-
return false;
29-
}
30-
return true;
26+
for (bin_int_t i = 0; i < BIN_BITS; i++) {
27+
if (!x.bits[i])
28+
return false;
29+
}
30+
return true;
3131
}
3232

3333
// Test if two binary numbers are equal.
3434
bool binEQ(const bin x, const bin y) {
35-
for (bin_int_t i = 0; i < BIN_BITS; i++) {
36-
if (x.bits[i] != y.bits[i])
37-
return false;
38-
}
39-
return true;
35+
for (bin_int_t i = 0; i < BIN_BITS; i++) {
36+
if (x.bits[i] != y.bits[i])
37+
return false;
38+
}
39+
return true;
4040
}
4141

4242
// Test if a binary number is greater than another.
4343
bool binGT(const bin x, const bin y) {
44-
for (int i = BIN_BITS-1; i >= 0; --i) {
45-
if (x.bits[i] != y.bits[i])
46-
return x.bits[i] && !y.bits[i];
47-
}
48-
return false;
44+
for (int i = BIN_BITS - 1; i >= 0; --i) {
45+
if (x.bits[i] != y.bits[i])
46+
return x.bits[i] && !y.bits[i];
47+
}
48+
return false;
4949
}
5050

51-
// Test if a binary number is less than another.
52-
bool binLT(const bin x, const bin y) {
53-
return !binEQ(x, y) && !binGT(x, y);
54-
}
51+
// Test if binary number is less than another.
52+
bool binLT(const bin x, const bin y) { return !binEQ(x, y) && !binGT(x, y); }
5553

5654
// Test if a binary number is greater than or equal to another.
57-
bool binGTEQ(const bin x, const bin y) {
58-
return !binLT(x, y);
59-
}
55+
bool binGTEQ(const bin x, const bin y) { return !binLT(x, y); }
6056

6157
// Test if a binary number is less than or equal to another.
62-
bool binLTEQ(const bin x, const bin y) {
63-
return !binGT(x, y);
64-
}
58+
bool binLTEQ(const bin x, const bin y) { return !binGT(x, y); }

src/math.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ bin binIncrement(const bin x);
3737
* @param y The binary number to subtract (subtrahend)
3838
* @return The difference of x and y as a binary number (x - y)
3939
*
40-
* @note This function performs standard binary subtraction with borrow handling.
41-
* If y > x, the result will be the two's complement representation.
40+
* @note This function performs standard binary subtraction with borrow
41+
* handling. If y > x, the result will be the two's complement representation.
4242
*/
4343
bin binSubtract(const bin x, const bin y);
4444

@@ -113,7 +113,8 @@ bin binPow(const bin x, const bin y);
113113
* @param x The binary number to calculate the square root of
114114
* @return The square root of x as a binary number
115115
*
116-
* @note This function implements the Newton-Raphson method for square root calculation.
116+
* @note This function implements the Newton-Raphson method for square root
117+
* calculation.
117118
*/
118119
bin binSqrt(const bin x);
119120

0 commit comments

Comments
 (0)