Repository navigation
Fix #4974 - Print binary Cd data in value order ##disasm - #27348
Merged
Merged
Conversation
With a binary immbase, Cd data printed the bits in memory order, while every other base prints the value, so a little endian dword 3 showed as 00000011000000000000000000000000b. Print the most significant byte first. When the value fits the directive, the text now assembles back to the same bytes, so pdj puts it in opcode, as it does for decimal.
Collaborator
|
Good to merge. No blockers found. The endian conversion is right, and the Built b43b3ba. Both changed r2r files pass. Also checked 120
|
Collaborator
|
Looks good to merge. The binary text now matches the value and endianness. The Small follow-ups:
|
2 of 3 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4974. With a binary immbase (
ahi 1), aCddata item printed its bits in memory order, while every other base prints the value read with the configured endianness. A little endian dword03 00 00 00showed as00000011000000000000000000000000b, so?on that text, as in the issue, gave a different number, ande cfg.bigendianmade no difference.data_type_tostringnow writes the value most significant byte first before printing the bits, so the binary text is the same value as the hex and decimal text, andcfg.bigendianchanges it the way it changes hex.When the value fits the directive, the text now assembles back to the same bytes (
rasm2round-trips.int16,.int32and.int64with absuffix on x86, arm and mips). Sodata_type_assemblestreats binary like decimal: pdj puts it inopcode, and keeps.hexthere for a single byte or a 16/32-bit value above the signed maximum. This drops the "binary digits follow memory order" exception from #27320.Something I left alone: for Cd data, immbase 1 is binary and 2 falls back to hex, while for instructions
ahi s(1) is string andahi b(2) is binary, asahi?says. Soahi bon a Cd item prints hex. I can change that here or in a separate PR if you want.Testing
test/db/cmd/metadata: the same dword printed with both endiannesses.cmd_pdjCd test with a dword that has the top bit set (.hexin opcode, binary in disasm) and a word (binary in opcode).metadata, one incmd_pdj).db/cmd/metadata(231),db/cmd/cmd_pdj(178),db/cmd/cmd_ahianddb/cmd/cmd_pdpass.sys/lint.py --allis clean.