Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtschump committed Jan 24, 2025
2 parents cb0f7fc + 4f036c5 commit ca1b445
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CImg.h
Original file line number Diff line number Diff line change
Expand Up @@ -6378,7 +6378,8 @@ namespace cimg_library {
//! Cut (i.e. clamp) absolute value in specified interval.
template<typename T>
inline T abscut(const T& val, const T& val_min, const T& val_max, const T& offset) {
return cimg::cut(cimg::abs(val) + offset,val_min,val_max)*cimg::sign(val);
const T sgn = cimg::sign(val);
return cimg::cut(val*sgn + offset,val_min,val_max)*sgn;
}

//! Return the nearest power of 2 higher than given value.
Expand Down

0 comments on commit ca1b445

Please sign in to comment.