@@ -110,7 +110,7 @@ static bool spiral_collides(sxbp_spiral_t* spiral, size_t index) {
110110/*
111111 * given a spiral struct that is known to collide, the index of the 'last'
112112 * segment in the spiral (i.e. the one that was found to be colliding) and a
113- * perfection threshold (-1 for no perfection, or otherwise the maximmum line
113+ * perfection threshold (0 for no perfection, or otherwise the maximmum line
114114 * length at which to allow aggressive optimisation), return a suggested length
115115 * to set the segment before this line to.
116116 *
@@ -131,7 +131,7 @@ static bool spiral_collides(sxbp_spiral_t* spiral, size_t index) {
131131 * - That index is less than spiral.size
132132 */
133133static sxbp_length_t suggest_resize (
134- sxbp_spiral_t spiral , size_t index , int perfection_threshold
134+ sxbp_spiral_t spiral , size_t index , sxbp_length_t perfection_threshold
135135) {
136136 // preconditional assertions
137137 assert (spiral .lines != NULL );
@@ -140,7 +140,7 @@ static sxbp_length_t suggest_resize(
140140 // check if collides or not, return same size if no collision
141141 if (spiral .collides ) {
142142 /*
143- * if the perfection threshold is -1 , then we can just use our
143+ * if the perfection threshold is 0 , then we can just use our
144144 * suggestion, as perfection is disabled.
145145 * otherwise, if the colliding line's length is greater than our
146146 * perfection threshold, we cannot make any intelligent suggestions on
@@ -149,8 +149,8 @@ static sxbp_length_t suggest_resize(
149149 * the previous line's length +1
150150 */
151151 if (
152- (perfection_threshold != -1 ) &&
153- (spiral .lines [index ].length > ( sxbp_length_t ) perfection_threshold )
152+ (perfection_threshold > 0 ) &&
153+ (spiral .lines [index ].length > perfection_threshold )
154154 ) {
155155 return spiral .lines [index - 1 ].length + 1 ;
156156 }
@@ -207,7 +207,7 @@ static sxbp_length_t suggest_resize(
207207
208208/*
209209 * given a pointer to a spiral struct, the index of one of it's lines and a
210- * target length to set that line to and a perfection threshold (-1 for no
210+ * target length to set that line to and a perfection threshold (0 for no
211211 * perfection, or otherwise the maximmum line length at which to allow
212212 * aggressive optimisation) attempt to set the target line to that length,
213213 * back-tracking to resize the previous line if it collides.
@@ -219,7 +219,7 @@ static sxbp_length_t suggest_resize(
219219 */
220220sxbp_status_t sxbp_resize_spiral (
221221 sxbp_spiral_t * spiral , uint64_t index , sxbp_length_t length ,
222- int perfection_threshold
222+ sxbp_length_t perfection_threshold
223223) {
224224 // preconditional assertions
225225 assert (spiral -> lines != NULL );
@@ -282,7 +282,7 @@ sxbp_status_t sxbp_resize_spiral(
282282
283283/*
284284 * given a pointer to a spiral spiral for which the length of all its lines are
285- * not yet known, a perfection threshold (-1 for no perfection, or otherwise
285+ * not yet known, a perfection threshold (0 for no perfection, or otherwise
286286 * the maximmum line length at which to allow aggressive optimisation), the
287287 * index of the highest line to plot to, a pointer to a callback function and
288288 * a void pointer to a user-defined data struct for use with the callback,
@@ -303,7 +303,7 @@ sxbp_status_t sxbp_resize_spiral(
303303 * - That spiral->lines is not NULL
304304 */
305305sxbp_status_t sxbp_plot_spiral (
306- sxbp_spiral_t * spiral , int perfection_threshold , uint64_t max_line ,
306+ sxbp_spiral_t * spiral , sxbp_length_t perfection_threshold , uint64_t max_line ,
307307 void (* progress_callback )(
308308 sxbp_spiral_t * spiral , uint64_t latest_line , uint64_t target_line ,
309309 void * progress_callback_user_data
0 commit comments