Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
encountered in https://go-review.googlesource.com/c/38071/:
assuming x and y are uint64:
only uses a single DIV instruction on amd64 however on 386 this makes a runtime call to
SGTM. We even already have this, although it's called dodiv at the moment.
The compiler should already do this. Worth double-checking, though.
:) I see.
Both seem worth fixing, then.
Independently, I wonder whether it's worth adding an int32 code path, where we do all the work with int32s instead of int64s, for values that fit in 32 bits (which is probably almost all of them in practice). Might even be cheaper on 64 bit machines. Probably worth a benchmarking experiment.