Skip to content

Commit

Permalink
add static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
yumetodo committed Nov 18, 2016
1 parent 8fbf889 commit 9c85cac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion SigColorFastAviUtl/filter_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include "filter.h"
enum class track : std::uint8_t {
midtone = 0,
strength = 1
strength = 1,
size
};
enum class check : std::uint8_t {
Y = 0,
Expand All @@ -19,6 +20,7 @@ enum class check : std::uint8_t {
save_benchmark = 5,
disable_benchmark_during_export = 6,
#endif
size
};
enum filter_update_track_status : int {
FILTER_UPDATE_MIDTONE_TRACK = FILTER_UPDATE_STATUS_TRACK + static_cast<int>(track::midtone),
Expand Down
15 changes: 9 additions & 6 deletions SigColorFastAviUtl/sigcolorfastaviutl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ static int track_e[] = { 100, 30 }; // maximum values
static_assert(
std_future::size(en_name) == std_future::size(track_default)
&& std_future::size(track_default) == std_future::size(track_s)
&& std_future::size(track_s) == std_future::size(track_e),
&& std_future::size(track_s) == std_future::size(track_e)
&& std_future::size(track_s) == static_cast<std::size_t>(track::size),
"error"
);

Expand All @@ -44,7 +45,11 @@ static int check_default[] = {
,1,0,1
#endif
}; // for checkbox: 0(unchecked) or 1(checked); for button: must be -1
static_assert(std_future::size(check_name_en) == std_future::size(check_default), "error");
static_assert(
std_future::size(check_name_en) == std_future::size(check_default)
&& std_future::size(check_name_en) == static_cast<std::size_t>(check::size),
"error"
);

namespace sigmoid_contrast {
static SigmoidTable ST;
Expand Down Expand Up @@ -115,10 +120,8 @@ namespace sigmoid_contrast {
if (fc.none_of(check::R, check::G, check::B)){
/* Scan Y channel data */
parallel::par_for(fpip->h, [fpip](int begin, int end) {
for (int r = begin; r < end; r++)
{
for (int c = 0; c < fpip->w; c++)
{
for (int r = begin; r < end; r++){
for (int c = 0; c < fpip->w; c++){
PIXEL_YC* const px = fpip->ycp_edit + r* fpip->max_w + c;
px->y = ST.lookup(px->y);
}
Expand Down

0 comments on commit 9c85cac

Please sign in to comment.