Source File
fields.go
Belonging Package
github.com/gotd/td/bin
package bin
import
// Fields represent a bitfield value that compactly encodes
// information about provided conditional fields, e.g. says
// that fields "1", "5" and "10" were set.
type Fields uint32
// Zero returns true, if all bits are equal to zero.
func ( Fields) () bool {
return == 0
}
// String implement fmt.Stringer
func ( Fields) () string {
return strconv.FormatUint(uint64(), 2)
}
// Decode implements Decoder.
func ( *Fields) ( *Buffer) error {
, := .Int32()
if != nil {
return
}
* = Fields()
return nil
}
// Encode implements Encoder.
func ( Fields) ( *Buffer) error {
.PutUint32(uint32())
return nil
}
// Has reports whether field with index n was set.
func ( Fields) ( int) bool {
return &(1<<) != 0
}
// Unset unsets field with index n.
func ( *Fields) ( int) {
* &= ^(1 << )
}
// Set sets field with index n.
func ( *Fields) ( int) {
* |= 1 <<
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |