Skip to content

Commit

Permalink
Change boolean debug representation
Browse files Browse the repository at this point in the history
The default one is too verbose.

Before:

```
(StdArray([BA32(BitArray<u8, bitvec::order::Lsb0> { addr: 0x12b842774, head: 000, bits: 32 } [1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1])]), StdArray([BA32(BitArray<u8, bitvec::order::Lsb0> { addr: 0x12b842778, head: 000, bits: 32 } [0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0])]))
```

after

```
(StdArray([BA32([1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1])]), StdArray([BA32([0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0])]))
```
  • Loading branch information
akoshelev committed Mar 4, 2024
1 parent 57b4d49 commit b6be6f3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ipa-core/src/ff/boolean_array.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::{Debug, Formatter};

use bitvec::{
prelude::{BitArr, Lsb0},
slice::Iter,
Expand Down Expand Up @@ -254,9 +256,15 @@ macro_rules! boolean_array_impl {
type Store = BitArr!(for $bits, in u8, Lsb0);

/// A Boolean array with $bits bits.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct $name(pub(super) Store);

impl Debug for $name {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}({})", stringify!($name), self.0)
}

Check warning on line 265 in ipa-core/src/ff/boolean_array.rs

View check run for this annotation

Codecov / codecov/patch

ipa-core/src/ff/boolean_array.rs#L263-L265

Added lines #L263 - L265 were not covered by tests
}

impl $name {
#[cfg(all(test, unit_test))]
const STORE_LEN: usize = bitvec::mem::elts::<u8>($bits);
Expand Down

0 comments on commit b6be6f3

Please sign in to comment.