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

Function decodeMediumNumber

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

Source from the content-addressed store, hash-verified

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