From b70e63d87a543bd24a6387b3dfd20b589364827a Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Sat, 6 Nov 2021 08:07:17 +0000 Subject: [PATCH] convert max and min bounds to ints in const_int() --- binarycpython/utils/spacing_functions.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/binarycpython/utils/spacing_functions.py b/binarycpython/utils/spacing_functions.py index d4ae9c4c5..c3e0be388 100644 --- a/binarycpython/utils/spacing_functions.py +++ b/binarycpython/utils/spacing_functions.py @@ -39,21 +39,21 @@ def const_int( Samples an integer range linearly. Returns a list of ints. Args: - min_bound: lower bound of range - max_bound: upper bound of range + min_bound: lower bound of range, must be an integer (is converted to int) + max_bound: upper bound of range, must be an integer (is converted to int) steps: number of segments between min_bound and max_bound Returns: range(min_bound,max_bound,step) - where step is int((max_bound-min_bound)/steps) + where step is int((int(max_bound)-int(min_bound))/steps) """ - step = int((max_bound-min_bound)/(steps-1)) + step = int((int(max_bound)-int(min_bound))/(steps-1)) if steps <= 1: - return min_bound + return int(min_bound) else: - return range(min_bound,max_bound+step,step) + return range(int(min_bound),int(max_bound+step),step) ############################################################ -- GitLab