Mathematically Find Max Value without Conditional Comparison

前端 未结 14 633
暗喜
暗喜 2020-12-03 03:39

----------Updated ------------

codymanix and moonshadow have been a big help thus far. I was able to solve my problem using the equations and instead of using right

14条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 04:12

    If you can't trust your environment to generate the appropriate branchless operations when they are available, see this page for how to proceed. Note the restriction on input range; use a larger integer type for the operation if you cannot guarantee your inputs will fit.

提交回复
热议问题