Converting some assembly to VB.NET - does the SHR operator work differently?

Well, a simple question here

I study assembly and convert some assembly procedures back to VB.NET

Now, there is a specific line of code that I came across in the assembly, suppose the following:

EBX = F0D04080

Then the following line is executed

SHR EBX, 4

Which gives me the following:

EBX = 0F0D0408

Now, in VB.NET, I am doing the following

variable = variable >> 4

Which SHOULD give me the same thing ... But it differs in the SLIGHT bit and not the value 0F0D0408, I get FF0D0408

So what is going on here?

+3
source share
2 answers

From the documentation → operator :

, , , () , . , , ; .

, F0B04080 ( 1 ), .

- VB.NET, : variable >> 4 IL shr, " " , x86 shr, . x86 SAR.

VB.NET, :

Dim variable As UInteger = &HF0D04080UI

UI F0D04080 VB.NET, ( , , ).

+4

VB >> , , 0.

variable = (variable >> shift_amt) And Not (Integer.MinValue >> (shift_amt - 1))

, . (UInteger UInt32), .

+1

Source: https://habr.com/ru/post/1754149/


All Articles