Skip to content

Commit

Permalink
Add asserts to help with #30.
Browse files Browse the repository at this point in the history
  • Loading branch information
prideout committed Oct 15, 2019
1 parent 6b45f93 commit 4e888b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion par_shapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1685,8 +1685,9 @@ static void par_shapes__weld_points(par_shapes_mesh* mesh, int gridsize,
// Check for colocated points in each nearby bin.
for (int b = 0; b < nbins; b++) {
int binindex = nearby[b];
PAR_SHAPES_T binvalue = *(bins + binindex);
PAR_SHAPES_T binvalue = bins[binindex];
PAR_SHAPES_T nindex = binvalue - 1;
assert(nindex < mesh->npoints);
while (true) {

// If this isn't "self" and it's colocated, then weld it!
Expand Down Expand Up @@ -1752,6 +1753,9 @@ static void par_shapes__weld_points(par_shapes_mesh* mesh, int gridsize,
PAR_SHAPES_T b = weldmap[tsrc[1]];
PAR_SHAPES_T c = weldmap[tsrc[2]];
if (a != b && a != c && b != c) {
assert(a < mesh->npoints);
assert(b < mesh->npoints);
assert(c < mesh->npoints);
*tdst++ = a;
*tdst++ = b;
*tdst++ = c;
Expand Down

0 comments on commit 4e888b1

Please sign in to comment.