MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / decodeMediumNumber

Function decodeMediumNumber

pkg/util/encoding/decimal.go:428–453  ·  view source on GitHub ↗
(
	negative bool, buf []byte, tmp []byte,
)

Source from the content-addressed store, hash-verified

426}
427
428func decodeMediumNumber(
429 negative bool, buf []byte, tmp []byte,
430) (e int, m []byte, rest []byte, newTmp []byte, err error) {
431 idx, err := findDecimalTerminator(buf[1:])
432 if err != nil {
433 return 0, nil, nil, nil, err
434 }
435
436 m = buf[1 : idx+1]
437 if negative {
438 e = int(decimalNegMedium - buf[0])
439 var mCpy []byte
440 if k := len(m); k <= len(tmp) {
441 mCpy = tmp[:k]
442 tmp = tmp[k:]
443 } else {
444 mCpy = make([]byte, k)
445 }
446 copy(mCpy, m)
447 onesComplement(mCpy)
448 m = mCpy
449 } else {
450 e = int(buf[0] - decimalPosMedium)
451 }
452 return e, m, buf[idx+2:], tmp, nil
453}
454
455func decodeLargeNumber(
456 negative bool, buf []byte, tmp []byte,

Callers 1

decodeDecimalFunction · 0.85

Calls 2

findDecimalTerminatorFunction · 0.85
onesComplementFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…