flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > crc32 calculation using crc32 opcode

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 269
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
Code:
; rdx - String, cl - Length CalculateCRC32: if RawMode xor r8d,r8d or eax,-1 lea r9,[TableCRC32] .1: mov r8b,[rdx] inc rdx xor r8b,al shr eax,8 ; Crc shr 8 xor eax,[r8*4+r9] ; Tab[Crc xor Byte] xor (Crc shr 8) dec cl jnz .1 not eax ;xor eax,-1 else xor eax,eax .1: crc32 eax,byte [rdx] inc rdx dec cl jnz .1 end if ret

I want both methods to give the same results. How to use crc32 opcode? What is badly?

_________________
smaller is better
Post 23 Mar 2017, 16:23
View user's profile Send private message Reply with quote
redsock



Joined: 09 Oct 2009
Posts: 283
Location: Australia
Since you didn't include a reference to your CRC32 table(s), the CRC32 instruction does the fixed Castagnoli polynomial (0x11EDC6F41) which is incompatible with most of the things I needed CRC32 for. See my own implementation at https://2ton.com.au/library_as_html/crc.inc.html. Also see Mark Adler's (zlib author) answer here for CRC32C http://stackoverflow.com/questions/17645167/implementing-sse-4-2s-crc32c-in-software and this discussion over at Intel: https://software.intel.com/en-us/forums/intel-isa-extensions/topic/302146

_________________
2 Ton Digital - https://2ton.com.au/
Post 23 Mar 2017, 21:14
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 2004-2018, Tomasz Grysztar.

Powered by rwasa.