-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace BitsSignedB{32,64}Le with better BitsSignedShiftB{32,64}Le
Note: BitsSignedB{32,64}Le were removed in the previous commit 43d8b74 According to my tests, new formats BitsSignedShiftB{32,64}Le have better detection capabilities than their predecessors. Old tests only detected kaitai-io/kaitai_struct_javascript_runtime@1f8dd95a, but did not catch the bug when I intentionally change the appropriate unsigned right shift `>>>` to signed `>>` in the new `readBitsIntLe` impl introduced in kaitai-io/kaitai_struct#949. Tests added in this commit reveal both of these errors.
- Loading branch information
1 parent
43d8b74
commit b7e567f
Showing
6 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Make sure that languages with 32-bit operators (JavaScript) use *unsigned* | ||
# (aka zero-fill) right shift, not signed (sign-propagating) right shift. This | ||
# test will fail if a signed shift is used. | ||
meta: | ||
id: bits_signed_shift_b32_le | ||
bit-endian: le | ||
seq: | ||
- id: a | ||
type: b31 | ||
- id: b | ||
type: b9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Make sure that languages with 64-bit operators (Java, PHP) use *unsigned* (aka | ||
# zero-fill) right shift, not signed (sign-propagating) right shift. This test | ||
# will fail if a signed shift is used. | ||
meta: | ||
id: bits_signed_shift_b64_le | ||
bit-endian: le | ||
seq: | ||
- id: a | ||
type: b63 | ||
- id: b | ||
type: b9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
id: bits_signed_shift_b32_le | ||
data: bits_signed_shift_b32_le.bin | ||
asserts: | ||
- actual: a | ||
expected: 0 | ||
- actual: b | ||
expected: 0xff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
id: bits_signed_shift_b64_le | ||
data: bits_signed_shift_b64_le.bin | ||
asserts: | ||
- actual: a | ||
expected: 0 | ||
- actual: b | ||
expected: 0xff |
Binary file not shown.
Binary file not shown.