MCPcopy
hub / github.com/golang/tools / Bool

Method Bool

internal/pkgbits/encoder.go:267–276  ·  view source on GitHub ↗

Bool encodes and writes a bool value into the element bitstream, and then returns the bool value. For simple, 2-alternative encodings, the idiomatic way to call Bool is something like: if w.Bool(x != 0) { // alternative #1 } else { // alternative #2 } For multi-alternative encodings, use C

(b bool)

Source from the content-addressed store, hash-verified

265//
266// For multi-alternative encodings, use Code instead.
267func (w *Encoder) Bool(b bool) bool {
268 w.Sync(SyncBool)
269 var x byte
270 if b {
271 x = 1
272 }
273 err := w.Data.WriteByte(x)
274 w.checkErr(err)
275 return b
276}
277
278// Int64 encodes and writes an int64 value into the element bitstream.
279func (w *Encoder) Int64(x int64) {

Callers 3

ValueMethod · 0.95
scalarMethod · 0.95
bigIntMethod · 0.95

Calls 2

SyncMethod · 0.95
checkErrMethod · 0.95

Tested by

no test coverage detected