|
1 | 1 | use crate::stm::Stake;
|
2 |
| -#[cfg(feature = "num-integer-backend")] |
| 2 | +#[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))] |
3 | 3 | use {
|
4 | 4 | num_bigint::{BigInt, Sign},
|
5 | 5 | num_rational::Ratio,
|
6 | 6 | num_traits::{One, Signed},
|
7 | 7 | std::ops::Neg,
|
8 | 8 | };
|
9 | 9 |
|
10 |
| -#[cfg(feature = "num-integer-backend")] |
| 10 | +#[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))] |
11 | 11 | /// Checks that ev is successful in the lottery. In particular, it compares the output of `phi`
|
12 | 12 | /// (a real) to the output of `ev` (a hash). It uses the same technique used in the
|
13 | 13 | /// [Cardano ledger](https://github.com/input-output-hk/cardano-ledger/). In particular,
|
@@ -49,7 +49,7 @@ pub(crate) fn ev_lt_phi(phi_f: f64, ev: [u8; 64], stake: Stake, total_stake: Sta
|
49 | 49 | taylor_comparison(1000, q, x)
|
50 | 50 | }
|
51 | 51 |
|
52 |
| -#[cfg(feature = "num-integer-backend")] |
| 52 | +#[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))] |
53 | 53 | /// Checks if cmp < exp(x). Uses error approximation for an early stop. Whenever the value being
|
54 | 54 | /// compared, `cmp`, is smaller (or greater) than the current approximation minus an `error_term`
|
55 | 55 | /// (plus an `error_term` respectively), then we stop approximating. The choice of the `error_term`
|
@@ -82,7 +82,7 @@ fn taylor_comparison(bound: usize, cmp: Ratio<BigInt>, x: Ratio<BigInt>) -> bool
|
82 | 82 | false
|
83 | 83 | }
|
84 | 84 |
|
85 |
| -#[cfg(not(feature = "num-integer-backend"))] |
| 85 | +#[cfg(not(any(feature = "num-integer-backend", target_family = "wasm", windows)))] |
86 | 86 | /// The crate `rug` has sufficient optimizations to not require a taylor approximation with early
|
87 | 87 | /// stop. The difference between the current implementation and the one using the optimization
|
88 | 88 | /// above is around 10% faster. We perform the computations with 117 significant bits of
|
@@ -146,7 +146,7 @@ mod tests {
|
146 | 146 | assert_eq!(quick_result, result);
|
147 | 147 | }
|
148 | 148 |
|
149 |
| - #[cfg(feature = "num-integer-backend")] |
| 149 | + #[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))] |
150 | 150 | #[test]
|
151 | 151 | /// Checking the early break of Taylor computation
|
152 | 152 | fn early_break_taylor(
|
|
0 commit comments