flat assembler
Message board for the users of flat assembler.
 flat assembler > Macroinstructions > crc32 calculation using crc32 opcode
Author
CandyMan

Joined: 04 Sep 2009
Posts: 232
Location: film "CandyMan" directed through Bernard Rose

crc32 calculation using crc32 opcode

 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
23 Mar 2017, 16:23
redsock

Joined: 09 Oct 2009
Posts: 265
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/
23 Mar 2017, 21:14
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------Blog General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area

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