Proper support for zero handles

This commit is contained in:
bloeys
2023-10-09 05:03:48 +04:00
parent c998fc26ce
commit 80ce6d60d2
2 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,12 @@ const (
// Byte 1: Generation; Byte 2: Flags; Bytes 3-8: Index
type Handle uint64
// IsZero reports whether the handle is in its default 'zero' state.
// A zero handle is an invalid handle that does NOT point to any entity
func (h Handle) IsZero() bool {
return h == 0
}
func (h Handle) HasFlag(ef HandleFlag) bool {
return h.Flags()&ef > 0
}