summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Westman <james@jwestman.net>2023-09-14 10:19:49 -0500
committerJeremy BĂ­cha <jbicha@ubuntu.com>2023-09-14 15:36:38 -0400
commitf718704b09f812f05a7bfb4bbf99f12f1879f549 (patch)
tree1be21f862653682deadf43af4fa27f51b04c9bbb
parentccc4aee621a86380bedead6d367c017f14cdeeca (diff)
typelib: Fix byte order issue
Origin: https://gitlab.gnome.org/jwestman/blueprint-compiler/-/issues/131 Gbp-Pq: Name typelib-Fix-byte-order-issue.patch
-rw-r--r--blueprintcompiler/typelib.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/blueprintcompiler/typelib.py b/blueprintcompiler/typelib.py
index a42ab3a..7b186f7 100644
--- a/blueprintcompiler/typelib.py
+++ b/blueprintcompiler/typelib.py
@@ -64,11 +64,11 @@ class Field:
if not mask or sys.byteorder == "little":
self._shift = shift
elif self._type == "u8" or self._type == "i8":
- self._shift = 7 - shift
+ self._shift = 8 - (shift + mask)
elif self._type == "u16" or self._type == "i16":
- self._shift = 15 - shift
+ self._shift = 16 - (shift + mask)
else:
- self._shift = 31 - shift
+ self._shift = 32 - (shift + mask)
self._mask = (1 << mask) - 1 if mask else None
self._name = f"{offset}__{type}__{shift}__{mask}"