Skip to content

Commit

Permalink
Fix segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
heat1q committed Nov 19, 2020
1 parent ffb1134 commit 8a2b503
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions pyLDPC/ldpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
LIB_PATH = f"{os.path.dirname(os.path.abspath(__file__))}/libldpc.so"

class sim_results_t(ct.Structure):
_fields_ = [("fer", ct.POINTER(ct.c_double*50)),
("ber", ct.POINTER(ct.c_double*50)),
("avg_iter", ct.POINTER(ct.c_double*50)),
("time", ct.POINTER(ct.c_double*50)),
("fec", ct.POINTER(ct.c_uint64*50)),
("frames", ct.POINTER(ct.c_uint64*50))]
_fields_ = [("fer", ct.POINTER(ct.c_double)),
("ber", ct.POINTER(ct.c_double)),
("avg_iter", ct.POINTER(ct.c_double)),
("time", ct.POINTER(ct.c_double)),
("fec", ct.POINTER(ct.c_uint64)),
("frames", ct.POINTER(ct.c_uint64))]

class decoder_param(ct.Structure):
_fields_ = [("earlyTerm", ct.c_bool),
Expand Down Expand Up @@ -45,7 +45,16 @@ def __init__(self, pc_file: str, gen_file = "", lib = LIB_PATH):
self.k = self.n - self.m

self.sim_stop_flag = ct.c_bool(False)
self.sim_results_struct = sim_results_t()
vec_double = ct.c_double * 50
vec_u64 = ct.c_uint64 * 50
self.sim_results_struct = sim_results_t(
vec_double(),
vec_double(),
vec_double(),
vec_double(),
vec_u64(),
vec_u64(),
)
self.results = {}
self.sim_params = {
"earlyTerm": True,
Expand Down

0 comments on commit 8a2b503

Please sign in to comment.