The compiler knows that the arrays are of type char and generates a
MOV EAX,BYTE PTR [addr]
If you want to load a 32 bit value from a byte array, tell the compiler that he has to load 32 bit words (untested but should do it):
__asm
{
mov eax,DWORD PTR [a]
mov ebx,DWORD PTR [b]
}
Or cast the char
array pointers to DWORD
pointers:
uint32_t* a32 = reinterpret_cast<uint32_t*>(a);
uint32_t* b32 = reinterpret_cast<uint32_t*>(b);
__asm
{
mov eax,a32[0]
mov ebx,b32[0]
}
Note that in both cases using
MOVZX
makes no sense when source and destination have the same size.
[EDIT]
Have tested it meanwhile. Using
DWORD PTR
works as expected while using a casted pointer does not work (loads register with address of a32 resp. b32).
[/EDIT]