Implement endian swap in visual bit editor ##visual

This commit is contained in:
pancake 2024-11-18 13:31:07 +01:00
parent fc4bfcde0f
commit e59c8b9386

View File

@ -699,6 +699,18 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
wordsize = 1;
}
break;
case 'e': // swap endian
{
ut8 a[8];
memcpy (a, buf, sizeof (a));
const int nbyte = x / 8;
const int last = R_MIN (nbyte + wordsize, 8);
int i;
for (i = nbyte; i < last; i++) {
buf[i] = a[last - 1 - i + nbyte];
}
}
break;
case 'Q':
case 'q':
if (analop.bytes) {
@ -851,6 +863,7 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
" q - quit the bit editor\n"
" R - randomize color palette\n"
" b - toggle bitsInLine\n"
" e - toggle endian of the selected word\n"
" j/k - toggle bit value (same as space key)\n"
" J/K - next/prev instruction (so+1,so-1)\n"
" h/l - select next/previous bit\n"