0

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
2

1 Answer 1

1

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
1
  • 1
    you can do: ?b -2 | tail -c 5 in order to evaluate the "-2" to binary without grepping.
    – Megabeets
    Commented Oct 26, 2018 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.