-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Description
I'm working on an arm64 math/big implementation.
The docs for addVW (arith.go) say:
// Argument y must be either 0 or 1.
func addVW_g(z, x []Word, y Word) (c Word)But e.g. running TestFloatSetPrec sends in many values for y. The existing implementations handle them correctly. I care because my initial arm64 implementation transfers y directly to the carry flag at the start, which only works if y is 0 or 1.
subVW does not say that y must be either 0 or 1, but in practice it appears to be, and the semantics are less clear if it is not. However, TestFunVW appears to intentionally send in y=2 to confirm that there's no bad behavior when z and x are nil.
What preconditions do addVW and subVW actually have?
@griesemer feel free to clarify here or just send a CL.
(Additional docs in general in arith.go would be awesome. Right now I'm inferring shlVU and friends from the existing code.)