notAllSet returns a check against all fields having been set in set.
()
| 611 | |
| 612 | // notAllSet returns a check against all fields having been set in set. |
| 613 | func (b *bmask) notAllSet() string { |
| 614 | var buf bytes.Buffer |
| 615 | buf.Grow(len(b.varname) + 16) |
| 616 | buf.WriteString(b.varname) |
| 617 | if b.bitlen > 64 { |
| 618 | var bytes []string |
| 619 | remain := b.bitlen |
| 620 | for remain >= 8 { |
| 621 | bytes = append(bytes, "0xff") |
| 622 | } |
| 623 | if remain > 0 { |
| 624 | bytes = append(bytes, fmt.Sprintf("0x%X", remain)) |
| 625 | } |
| 626 | fmt.Fprintf(&buf, " != [%d]byte{%s}\n", (b.bitlen+63)/64, strings.Join(bytes, ",")) |
| 627 | } |
| 628 | fmt.Fprintf(&buf, " != 0x%x", uint64(1<<b.bitlen)-1) |
| 629 | |
| 630 | return buf.String() |
| 631 | } |
no test coverage detected