Skip to content

Commit caba146

Browse files
committed
Substitute correct typedef in casts and use unsigned literal when adding
1 parent 4657d4e commit caba146

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

sxbp/refine_figure_grow_from_start.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,24 +266,24 @@ static sxbp_length_t sxbp_resolve_collision(
266266
// rule out the combinations of directions not featured in the table (any
267267
// non-parallel combos, which cannot be optimised in this manner)
268268
if((previous.direction == SXBP_UP) && (collider.direction == SXBP_UP)) {
269-
return (sxbp_figure_dimension_t)((collider_origin.y - previous_origin.y) + collider.length + 1);
269+
return (sxbp_length_t)((collider_origin.y - previous_origin.y) + collider.length + 1);
270270
} else if((previous.direction == SXBP_UP) && (collider.direction == SXBP_DOWN)) {
271-
return (sxbp_figure_dimension_t)((collider_end.y - previous_origin.y) + collider.length + 1);
271+
return (sxbp_length_t)((collider_end.y - previous_origin.y) + collider.length + 1);
272272
} else if((previous.direction == SXBP_RIGHT) && (collider.direction == SXBP_RIGHT)) {
273-
return (sxbp_figure_dimension_t)((collider_origin.x - previous_origin.x) + collider.length + 1);
273+
return (sxbp_length_t)((collider_origin.x - previous_origin.x) + collider.length + 1);
274274
} else if((previous.direction == SXBP_RIGHT) && (collider.direction == SXBP_LEFT)) {
275-
return (sxbp_figure_dimension_t)((collider_end.x - previous_origin.x) + collider.length + 1);
275+
return (sxbp_length_t)((collider_end.x - previous_origin.x) + collider.length + 1);
276276
} else if((previous.direction == SXBP_DOWN) && (collider.direction == SXBP_UP)) {
277-
return (sxbp_figure_dimension_t)((previous_origin.y - collider_end.y) + collider.length + 1);
277+
return (sxbp_length_t)((previous_origin.y - collider_end.y) + collider.length + 1);
278278
} else if((previous.direction == SXBP_DOWN) && (collider.direction == SXBP_DOWN)) {
279-
return (sxbp_figure_dimension_t)((previous_origin.y - collider_origin.y) + collider.length + 1);
279+
return (sxbp_length_t)((previous_origin.y - collider_origin.y) + collider.length + 1);
280280
} else if((previous.direction == SXBP_LEFT) && (collider.direction == SXBP_RIGHT)) {
281-
return (sxbp_figure_dimension_t)((previous_origin.x - collider_end.x) + collider.length + 1);
281+
return (sxbp_length_t)((previous_origin.x - collider_end.x) + collider.length + 1);
282282
} else if((previous.direction == SXBP_LEFT) && (collider.direction == SXBP_LEFT)) {
283-
return (sxbp_figure_dimension_t)((previous_origin.x - collider_origin.x) + collider.length + 1);
283+
return (sxbp_length_t)((previous_origin.x - collider_origin.x) + collider.length + 1);
284284
} else {
285285
// this is the catch-all case, where no way to optimise was found
286-
return previous.length + 1;
286+
return previous.length + 1U;
287287
}
288288
}
289289

@@ -325,7 +325,7 @@ static sxbp_length_t sxbp_suggest_previous_length(
325325
// );
326326
// // if the two lines are not parallel, just extend by 1 and return early
327327
if((previous.direction % 2u) != (collider.direction % 2u)) {
328-
return previous.length + 1;
328+
return previous.length + 1U;
329329
} else {
330330
/*
331331
* otherwise, use our callback function with sxbp_walk_figure() to get
@@ -349,7 +349,7 @@ static sxbp_length_t sxbp_suggest_previous_length(
349349
// TODO: replace with result of sxbp_resolve_collision() above
350350
// FIXME: This can't be done until sxbp_suggest_previous_length_callback
351351
// is fixed properly
352-
return previous.length + 1;
352+
return previous.length + 1U;
353353
}
354354
}
355355

0 commit comments

Comments
 (0)