Skip to content

Commit

Permalink
Replaced constrain(x, 0, y) with min(x, y) for unsigned types
Browse files Browse the repository at this point in the history
  • Loading branch information
Denzo77 committed Jul 25, 2017
1 parent 1898bb0 commit 9faa5ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions content/OTProtocolCC/utility/OTProtocolCC_OTProtocolCC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ CC1PollAndCommand CC1PollAndCommand::make(const uint8_t hc1, const uint8_t hc2,
CC1PollAndCommand r;
r.hc1 = hc1;
r.hc2 = hc2;
r.rp = constrain(rp, 0, 100);
r.rp = min(rp, 100);
r.lc = lc & 3; // Logical bit pattern for LEDs.
r.lt = constrain(lt, 1, 15);
r.lf = constrain(lf, 1, 3);
Expand Down Expand Up @@ -185,9 +185,9 @@ CC1PollResponse CC1PollResponse::make(const uint8_t hc1, const uint8_t hc2,
CC1PollResponse r;
r.hc1 = hc1;
r.hc2 = hc2;
r.rh = constrain(rh, 0, 50);
r.tp = constrain(tp, 0, 199);
r.tr = constrain(tr, 0, 199);
r.rh = min(rh, 50);
r.tp = min(tp, 199);
r.tr = min(tr, 199);
r.al = constrain(al, 1, 62);
r.s = s;
r.w = w;
Expand Down

0 comments on commit 9faa5ad

Please sign in to comment.