MCPcopy
hub / github.com/bnb-chain/bsc / genWrite

Method genWrite

rlp/rlpgen/gen.go:338–359  ·  view source on GitHub ↗
(ctx *genContext, v string)

Source from the content-addressed store, hash-verified

336}
337
338func (op uint256Op) genWrite(ctx *genContext, v string) string {
339 var b bytes.Buffer
340
341 dst := v
342 if !op.pointer {
343 dst = "&" + v
344 }
345 fmt.Fprintf(&b, "w.WriteUint256(%s)\n", dst)
346
347 // Wrap with nil check.
348 if op.pointer {
349 code := b.String()
350 b.Reset()
351 fmt.Fprintf(&b, "if %s == nil {\n", v)
352 fmt.Fprintf(&b, " w.Write(rlp.EmptyString)")
353 fmt.Fprintf(&b, "} else {\n")
354 fmt.Fprint(&b, code)
355 fmt.Fprintf(&b, "}\n")
356 }
357
358 return b.String()
359}
360
361func (op uint256Op) genDecode(ctx *genContext) (string, string) {
362 ctx.addImport("github.com/holiman/uint256")

Callers

nothing calls this directly

Calls 2

StringMethod · 0.65
ResetMethod · 0.65

Tested by

no test coverage detected