Skip to content

Commit

Permalink
Oops, move assert back to shut the compiler up.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasb-eyer committed Jan 3, 2014
1 parent b77a840 commit b1797cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions heatmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ unsigned char* heatmap_render_saturated_to(const heatmap_t* h, const heatmap_col
*/
const float val = (*bufline > saturation ? saturation : *bufline)/saturation;

/* This is probably caused by a negative entry in the stamp! */
assert(val >= 0.0f);

/* We add 0.5 in order to do real rounding, not just dropping the
* decimal part. That way we are certain the highest value in the
* colorscheme is actually used.
*/
const size_t idx = (size_t)((float)(colorscheme->ncolors-1)*val + 0.5f);

/* This is probably caused by a negative entry in the stamp! */
assert(val >= 0.0f);

/* This should never happen. It is likely a bug in this library. */
assert(idx < colorscheme->ncolors);

Expand Down

0 comments on commit b1797cc

Please sign in to comment.