clamp function as template instead of macro
too much parenthese in macros