Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASM typecasting

Status
Not open for further replies.

Glenn9999

Programmer
Jun 19, 2004
2,311
0
36
US
I've been able to get back into the assembler a bit more for various reasons. Anyhow, I'm still learning and I found something I would like some advice on.

Code:
crc32_out := CRC32tab[Byte(crc32_out xor DWord(PChar(inbuffer)^))] xor
                    ((crc32_out shr 8) and $00ffffff);

In converting this Pascal code, the thing I struggled with was the typecasting parts. Now I'm fine with the DWord typecast for most part ( XOR E?X, E?X then move byte to ?L ).

Now the Byte typecast was a little bit more trouble because I needed the lower byte of that result ( ?L ) to address the array represented by CRC32tab. I figured it out by using 3 or 4 instructions to clear the high 24-bits of the extended register.

But the question is this: Is there a better way to approach this problem?

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
But the question is this: Is there a better way to approach this problem?

Got this answered. Needed the MOVZX instruction.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top