diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-04 20:51:56 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-04 20:51:56 +0200 |
| commit | 1c0d4caf7c7a6ddd5cf24091249448bf2e169495 (patch) | |
| tree | 1f4d78d3a33158bfa05c415ddeddc6eaa5659995 /sys/decl.go | |
| parent | b6e402dd48c4b835a3a1cd53d4216fe0643392f5 (diff) | |
sys: change BitfieldLast to BitfieldMiddle
That's the condition we always want.
Currently we always check:
t.BitfieldOffset() == 0 || t.BitfieldLast()
now can check just:
!t.BitfieldMiddle()
Diffstat (limited to 'sys/decl.go')
| -rw-r--r-- | sys/decl.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/decl.go b/sys/decl.go index 1a474616f..077023cf2 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -34,7 +34,7 @@ type Type interface { Size() uint64 BitfieldOffset() uint64 BitfieldLength() uint64 - BitfieldLast() bool + BitfieldMiddle() bool // returns true for all but last bitfield in a group } func IsPad(t Type) bool { @@ -87,7 +87,7 @@ func (t *TypeCommon) BitfieldLength() uint64 { return 0 } -func (t *TypeCommon) BitfieldLast() bool { +func (t *TypeCommon) BitfieldMiddle() bool { return false } @@ -124,15 +124,7 @@ type IntTypeCommon struct { BitfieldOff uint64 BitfieldLen uint64 BigEndian bool - BitfieldLst bool -} - -func (t *IntTypeCommon) Size() uint64 { - // TODO(dvyukov): check that this is not a middle bitfield - // if t.BitfieldLen != 0 && !t.BitfieldLst { - // panic(fmt.Sprintf("bitfields don't have size: %#v", t)) - // } - return t.TypeCommon.Size() + BitfieldMdl bool } func (t *IntTypeCommon) BitfieldOffset() uint64 { @@ -143,8 +135,8 @@ func (t *IntTypeCommon) BitfieldLength() uint64 { return t.BitfieldLen } -func (t *IntTypeCommon) BitfieldLast() bool { - return t.BitfieldLst +func (t *IntTypeCommon) BitfieldMiddle() bool { + return t.BitfieldMdl } type ConstType struct { |
