MCPcopy Index your code
hub / github.com/microsoft/typescript-go / msgpackWriteString

Function msgpackWriteString

internal/api/encoder/encoder.go:781–793  ·  view source on GitHub ↗
(buf []byte, s string)

Source from the content-addressed store, hash-verified

779}
780
781func msgpackWriteString(buf []byte, s string) []byte {
782 n := len(s)
783 if n <= 0x1f {
784 buf = append(buf, byte(0xa0|n))
785 } else if n <= 0xff {
786 buf = append(buf, 0xd9, byte(n))
787 } else if n <= 0xffff {
788 buf = append(buf, 0xda, byte(n>>8), byte(n))
789 } else {
790 buf = append(buf, 0xdb, byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
791 }
792 return append(buf, s...)
793}
794
795func msgpackWriteBool(buf []byte, value bool) []byte {
796 if value {

Callers 2

encodeFileReferencesFunction · 0.85
encodeStringArrayFunction · 0.85

Calls 2

lenFunction · 0.85
appendFunction · 0.50

Tested by

no test coverage detected