Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c5816569a926
Choose a base ref
...
head repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c733acea0456
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Apr 6, 2019

  1. Copy the full SHA
    c733ace View commit details
Showing with 8 additions and 8 deletions.
  1. +8 −8 software/glasgow/support/bits.py
16 changes: 8 additions & 8 deletions software/glasgow/support/bits.py
Original file line number Diff line number Diff line change
@@ -33,14 +33,14 @@ def _check_integer(action, expected_width, value):
% (action, expected_width, value.bit_length(), value))

@classmethod
def _define_fields(cls, size_bits, fields):
total_width = sum(width for name, width in fields)
if total_width != size_bits:
raise TypeError("declared total width is %d bits, but sum of field widths is %d bits"
% (total_width, size_bits))

cls._size_bits = size_bits
cls._size_bytes = (size_bits + 7) // 8
def _define_fields(cls, declared_bits, fields):
total_bits = sum(width for name, width in fields)
if total_bits != declared_bits:
raise TypeError("declared width is %d bits, but sum of field widths is %d bits"
% (declared_bits, total_bits))

cls._size_bits = declared_bits
cls._size_bytes = (declared_bits + 7) // 8
cls._named_fields = []
cls._widths = OrderedDict()