[Bug]Hex Editor->Tools->Rotate Right

Find a Bug? Have a Problem? Like to Suggest a Feature? Do it Here

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

[Bug]Hex Editor->Tools->Rotate Right

Postby magizhang » Wed May 06, 2009 2:26 pm

mhs 5.007
the effect of "Rotate Right" is Shift Right

sorry for my poor english...
magizhang
I Have A Few Questions
 
Posts: 6
Joined: Mon Feb 02, 2009 6:00 am

Postby L. Spiro » Wed May 06, 2009 4:50 pm

Specify the value you shifted, along with type and by how much you shifted it.

My tests show it works correctly.

23117 >> 4 = 1444
23117 (Rotate Shift) 4 = 54692

This is the result I get.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby magizhang » Wed May 06, 2009 5:59 pm

L. Spiro wrote:Specify the value you shifted, along with type and by how much you shifted it.

My tests show it works correctly.

23117 >> 4 = 1444
23117 (Rotate Shift) 4 = 54692

This is the result I get.


L. Spiro

may it's not the very bug
but there must be something wrong

eg.

Treat Data as long

1C 5C D8 DC (Rotate RIGHT)6 gets 70 61 73 FF in MHS
while
1C 5C D8 DC (Rotate LEFT)26 = 70 61 73 73
magizhang
I Have A Few Questions
 
Posts: 6
Joined: Mon Feb 02, 2009 6:00 am

Postby L. Spiro » Thu May 07, 2009 6:25 am

That is because it is a signed type. If you shift right the sign byte carries, which is where you get the FF on one side.

If you meant to use unsigned long, you should use unsigned long.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby magizhang » Thu May 07, 2009 9:15 am

L. Spiro wrote:That is because it is a signed type. If you shift right the sign byte carries, which is where you get the FF on one side.

If you meant to use unsigned long, you should use unsigned long.


L. Spiro

not shift but rotate

i think
rotate a long should use rcl/rcr
rotate a ulong should be rol/ror
am i right?

btw

in disassembler of mhs
i write
Code: Select all
ROR EAX,6
RETN

then call function
set eax to DCD85C1Ch
Return:73736170

while
Code: Select all
RCR EAX,6
RETN

then call function
set eax to DCD85C1Ch
Return:E3736170
magizhang
I Have A Few Questions
 
Posts: 6
Joined: Mon Feb 02, 2009 6:00 am

Postby L. Spiro » Thu May 07, 2009 7:06 pm

I said the sign bit carries in shifting operations because rotating is a shift operation.

RCR is not related to the sign of the data; it uses the carry flag and extends the data size by one bit, which is not a capability of any hex editor.

In fact, my mistake was treating signed data as signed. In a rotate operation, all bits are rotated in an unsigned fashion, so there is no carry in signed types.


The fix has been uploaded. You will find it by redownloading MHS 5.007.

However while studying this issue I found another problem in the Hex Editor; changes to files disappear when the Hex Editor loses focus. I am completely puzzled as to why (or how) this happens, and will upload another patch as soon as I fix it. It only happens when modifying files.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby magizhang » Fri May 08, 2009 6:31 am

L. Spiro wrote:I said the sign bit carries in shifting operations because rotating is a shift operation.

RCR is not related to the sign of the data; it uses the carry flag and extends the data size by one bit, which is not a capability of any hex editor.

In fact, my mistake was treating signed data as signed. In a rotate operation, all bits are rotated in an unsigned fashion, so there is no carry in signed types.


The fix has been uploaded. You will find it by redownloading MHS 5.007.

However while studying this issue I found another problem in the Hex Editor; changes to files disappear when the Hex Editor loses focus. I am completely puzzled as to why (or how) this happens, and will upload another patch as soon as I fix it. It only happens when modifying files.


L. Spiro


:) Thanks L. Spiro! Thanks a lot for your cool software!

btw

when i open 2 files in hex editor,
add 2 more bookmarks in each file.
then keep changing between 2 file-tabs several times(nomore than 10 times)
the editor will crash

maybe something same happens with bookmark?
magizhang
I Have A Few Questions
 
Posts: 6
Joined: Mon Feb 02, 2009 6:00 am

Postby L. Spiro » Fri May 08, 2009 8:11 am

I can not reproduce the bug you describe.
I have 2 files, 2 bookmarks in each file, and switch between them repeatedly.
It works for me.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan


Return to Bugs/Problems/Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests