Re: Inline assembler syntax error in Delphi 2006



Menaka wrote:
When I tried your first solution , I get Operand type mismatch error.
Please do help me on this.
Can you tell me what is the difference b/w xor eax, DWORD [cCRC32Table][EBX*4] // Result:=eax xor Table[ebx]
and xor eax, DWORD [cCRC32Table][EBX] // Result:=eax xor TByteArray(Table)
and your second solution(xor eax, dword ptr [cCRC32Table + ebx * 4]) denotes // Result:=eax xor Table[ebx] Please explian

What exactly is your array? Array of integer? Array of Longword? Array of byte? Assuming that it is an array of 32-bit quantities.

xor eax, DWORD [cCRC32Table][EBX*4]

This is bizarre syntax. If Delphi knows that you are trying to access array elements, then this is trying to XOR with the element of the array at index EBX*4.

xor eax, DWORD [cCRC32Table][EBX]

This is trying to xor with the element with index EBX. This is probably what you want, but the syntax is odd.

xor eax, dword ptr [cCRC32Table + ebx * 4]

This XORs with the element with index EBX, if the array cCRC32Table is an array of 32-bit (ie. 4 byte) quantities. This is probably what you want. (All the CRC32 tables I have come across are arrays of 4-byte quantities, IIRC).

Cheers,
Nicholas Sherlock

--
http://www.sherlocksoftware.org
.



Relevant Pages

  • Re: puzzle
    ... >>> in the array appear exactly two times except one. ... XOR it with the second number. ... XORing and transforming the result back. ... it's possible to produce negative zeros ...
    (comp.lang.c)
  • Re: puzzle
    ... >> I still don't see the actual XOR solution. ... The validity of the operation for a floating point array forces the ... The student learns here that complexity theory is subordinate to C ...
    (comp.programming)
  • Re: puzzle
    ... Peter Nilsson wrote: ... >>> in the array appear exactly two times except one. ... XOR it with the second number. ... it's possible to produce negative zeros ...
    (comp.lang.c)
  • Conditional Generates
    ... of this generate to set the connectivity of the array. ... dInxor dataVector; ... dataVector <= dataVectorNext; ... BitGen0: if generate ...
    (comp.lang.vhdl)
  • Re: puzzle
    ... The general idea is to select a pivot value and then partition the array into elements smaller than the pivot, equal to the pivot, and larger than the pivot. ... solution Nilges would accept, if he were the kind of person who accepts ... (I was going to point out that (if XOR existed in APL) ...
    (comp.programming)