MCPcopy Create free account
hub / github.com/cockroachdb/apd / addInline

Function addInline

bigint.go:307–323  ·  view source on GitHub ↗

inline arithmetic for small values // gcassert:inline

(xVal, yVal uint64, xNeg, yNeg bool)

Source from the content-addressed store, hash-verified

305
306//gcassert:inline
307func addInline(xVal, yVal uint64, xNeg, yNeg bool) (zVal uint64, zNeg, ok bool) {
308 if xNeg == yNeg {
309 sum, carry := bits.Add64(xVal, yVal, 0)
310 overflow := carry != 0
311 return sum, xNeg, !overflow
312 }
313
314 diff, borrow := bits.Sub64(xVal, yVal, 0)
315 if borrow != 0 { // underflow
316 xNeg = !xNeg
317 diff = yVal - xVal
318 }
319 if diff == 0 {
320 xNeg = false
321 }
322 return diff, xNeg, true
323}
324
325//gcassert:inline
326func mulInline(xVal, yVal uint64, xNeg, yNeg bool) (zVal uint64, zNeg, ok bool) {

Callers 2

AddMethod · 0.85
SubMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…