Sounds good to me. I'm not familiar with any performance tradeoffs like branch prediction changes, but I assume the compiler result is equivalent.
func CmpX(x, y X) int { if x == y { return 0 } if x < y { return -1 } return 1 } Matt On Sunday, January 21, 2018 at 10:44:35 AM UTC-6, Jan Mercl wrote: > > On Sun, Jan 21, 2018 at 4:32 PM <matthe...@gmail.com <javascript:>> wrote: > > All the else clauses should be dropped. > > > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.