From 128b1309a1cedc857049a4d063e82c1ca4ecd10c Mon Sep 17 00:00:00 2001 From: Vojta Mrazek Date: Fri, 5 Apr 2024 09:24:03 +0200 Subject: [PATCH] popcount fixes --- ariths_gen/multi_bit_circuits/others/popcount.py | 4 ++-- tests/test_popcnt.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ariths_gen/multi_bit_circuits/others/popcount.py b/ariths_gen/multi_bit_circuits/others/popcount.py index 04fcda3..4721bce 100644 --- a/ariths_gen/multi_bit_circuits/others/popcount.py +++ b/ariths_gen/multi_bit_circuits/others/popcount.py @@ -1,7 +1,7 @@ """ """ -from typing import Union +from typing import Union, Optional from ariths_gen.wire_components import ( Wire, @@ -45,7 +45,7 @@ class UnsignedPopCount(GeneralCircuit): """ - def __init__(self, a: Bus, adder : Union[ArithmeticCircuit, None] = None, prefix : str = "", name : str = "popcnt", **kwargs): + def __init__(self, a: Bus, adder : Optional[ArithmeticCircuit] = None, prefix : str = "", name : str = "popcnt", **kwargs): self.N = a.N self.a = a diff --git a/tests/test_popcnt.py b/tests/test_popcnt.py index 52de63f..a877254 100644 --- a/tests/test_popcnt.py +++ b/tests/test_popcnt.py @@ -1,3 +1,4 @@ +from io import StringIO from ariths_gen.core.cgp_circuit import UnsignedCGPCircuit from ariths_gen.wire_components import ( Wire, @@ -11,6 +12,7 @@ from ariths_gen.core.arithmetic_circuits import GeneralCircuit from ariths_gen.multi_bit_circuits.others import ( UnsignedPopCount ) +import numpy as np def test_popcount():