MCPcopy Index your code
hub / github.com/vmihailenco/msgpack / encodeStringLen

Method encodeStringLen

encode_slice.go:54–65  ·  view source on GitHub ↗
(l int)

Source from the content-addressed store, hash-verified

52}
53
54func (e *Encoder) encodeStringLen(l int) error {
55 if l < 32 {
56 return e.writeCode(msgpcode.FixedStrLow | byte(l))
57 }
58 if l < 256 {
59 return e.write1(msgpcode.Str8, uint8(l))
60 }
61 if l <= math.MaxUint16 {
62 return e.write2(msgpcode.Str16, uint16(l))
63 }
64 return e.write4(msgpcode.Str32, uint32(l))
65}
66
67func (e *Encoder) EncodeString(v string) error {
68 if intern := e.flags&useInternedStringsFlag != 0; intern || len(e.dict) > 0 {

Callers 1

encodeNormalStringMethod · 0.95

Calls 4

writeCodeMethod · 0.95
write1Method · 0.95
write2Method · 0.95
write4Method · 0.95

Tested by

no test coverage detected