Commit 1b913055 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

C++ API in __shift_clause()

parent 428d6225
......@@ -441,14 +441,16 @@ class CLUnfolder(object):
@warning: lock the unfolder
"""
self.__locked = True # shift_step must be frozen
shift_c = []
for lit in ncl:
if lit > 0:
slit = lit + self.__shift_step
else:
slit = lit - self.__shift_step
shift_c.append(slit)
return shift_c
# Old API
# Less efficient with abs()
# return [(abs(lit) + self.__shift_step) * (-1 if lit < 0 else 1) for lit in ncl]
# More efficient with ternary assignment
# return [(lit + self.__shift_step) if lit > 0 else (lit - self.__shift_step)
# for lit in ncl]
# New API via C++ module
return shift_clause(ncl, self.__shift_step)
def __m_shift_clause(self, ncl, nb_steps):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment