golang what is the right way to use math.max on two uint values?
The main reason math.Max
exists is to ensure some of the special cases of IEEE floating point are handled correctly (positive and negative infinity, NaN
and signed zeroes).
These issues are not relevant for simple integers, so you may as well just use the obvious implementation. Something like:
if args.Viewnum+1 > vs.curView.Viewnum {
vs.curView.Viewnum = args.Viewnum+1
}