Is there anyway to set the width of the twos compliment used in binary display =2
?
2
10b
-2
1111111111111111111111111111111111111111111111111111111111111110b
I would like to see a 3bit signed twos compliment representation.
2
010b
-2
110b
It is not possible directly with rax2, check this line, because char strbits[65];
fixed for 64bit (65th byte is for b
char).
You can mix rax command to shell commands to giving your result:
$rax2 Bx-2 | tail -c 5
110b
Or directly in radare2
[0x100050e26]> ? Bx-2~bin | tail -c 4
110
?b -2 | tail -c 5
in order to evaluate the "-2" to binary without grepping.
Commented
Oct 26, 2018 at 8:07
rax2
is a utility in the radare2 framework, responsible for expression evaluation. radare.gitbooks.io/radare2book/tools/rax2/intro.html