<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Merge a fast CRC32 snippet with it's CRC32 table help needed' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Merge a fast CRC32 snippet with it's CRC32 table help needed' posted on the 'x86 Assembly' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 07:33:35 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 07:33:35 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252558/merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/</link>
      <description>This is supposed to be a fast CRC 32 algorithmn. I would like some help to see if it really is faster compared to what I already have. The table is below this code. I don't know how to merge the two.&lt;br /&gt;
&lt;br /&gt;
I don't recognize the enter 0,0, leave, and ret 16 statements.&lt;br /&gt;
&lt;br /&gt;
Thanks.&lt;br /&gt;
&lt;br /&gt;
; Copyright (c) 2002&lt;br /&gt;
; Pavel "EvilOne" Minayev&lt;br /&gt;
;&lt;br /&gt;
; Permission to use, copy, modify, distribute and sell this software&lt;br /&gt;
; and its documentation for any purpose is hereby granted without fee,&lt;br /&gt;
; provided that the above copyright notice appear in all copies and&lt;br /&gt;
; that both that copyright notice and this permission notice appear&lt;br /&gt;
; in supporting documentation.  Author makes no representations about&lt;br /&gt;
; the suitability of this software for any purpose. It is provided&lt;br /&gt;
; "as is" without express or implied warranty.&lt;br /&gt;
&lt;br /&gt;
bits 32&lt;br /&gt;
&lt;br /&gt;
segment .text&lt;br /&gt;
start:&lt;br /&gt;
   enter 0, 0&lt;br /&gt;
   ; load arguments into registers&lt;br /&gt;
    mov ebx, [ebp+16]    ; CRC-table&lt;br /&gt;
    mov ecx, [ebp+12]    ; string length&lt;br /&gt;
   mov esi, [ebp+08]    ; string&lt;br /&gt;
   ; initialize&lt;br /&gt;
   mov eax, 0xFFFFFFFF&lt;br /&gt;
   xor edx, edx&lt;br /&gt;
calcbyte:&lt;br /&gt;
   ; process a single byte:&lt;br /&gt;
   ; crc = table[(unsigned char)crc ^ byte] ^ (crc &amp;gt;&amp;gt; 8)&lt;br /&gt;
   mov dl, al&lt;br /&gt;
   xor dl, [esi]&lt;br /&gt;
   shr eax, 8&lt;br /&gt;
   xor eax, [ebx+edx*4]&lt;br /&gt;
   inc esi&lt;br /&gt;
   loop calcbyte&lt;br /&gt;
   ; clean up and return&lt;br /&gt;
   leave&lt;br /&gt;
   ret 16&lt;br /&gt;
&lt;br /&gt;
; 32 bit reverse crc table for polynomial EDB88320h  (Zmodem,PKZip)&lt;br /&gt;
; X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^
5+X^4+X^2+X^1+X^0&lt;br /&gt;
&lt;br /&gt;
crc32tab  dd    000000000h, 077073096h, 0ee0e612ch, 0990951bah, 0076dc419h&lt;br /&gt;
        dd      0706af48fh, 0e963a535h, 09e6495a3h, 00edb8832h, 079dcb8a4h&lt;br /&gt;
        dd      0e0d5e91eh, 097d2d988h, 009b64c2bh, 07eb17cbdh, 0e7b82d07h&lt;br /&gt;
        dd      090bf1d91h, 01db71064h, 06ab020f2h, 0f3b97148h, 084be41deh&lt;br /&gt;
        dd      01adad47dh, 06ddde4ebh, 0f4d4b551h, 083d385c7h, 0136c9856h&lt;br /&gt;
        dd      0646ba8c0h, 0fd62f97ah, 08a65c9ech, 014015c4fh, 063066cd9h&lt;br /&gt;
        dd      0fa0f3d63h, 08d080df5h, 03b6e20c8h, 04c69105eh, 0d56041e4h&lt;br /&gt;
        dd      0a2677172h, 03c03e4d1h, 04b04d447h, 0d20d85fdh, 0a50ab56bh&lt;br /&gt;
        dd      035b5a8fah, 042b2986ch, 0dbbbc9d6h, 0acbcf940h, 032d86ce3h&lt;br /&gt;
        dd      045df5c75h, 0dcd60dcfh, 0abd13d59h, 026d930ach, 051de003ah&lt;br /&gt;
        dd      0c8d75180h, 0bfd06116h, 021b4f4b5h, 056b3c423h, 0cfba9599h&lt;br /&gt;
        dd      0b8bda50fh, 02802b89eh, 05f058808h, 0c60cd9b2h, 0b10be924h&lt;br /&gt;
        dd      02f6f7c87h, 058684c11h, 0c1611dabh, 0b6662d3dh, 076dc4190h&lt;br /&gt;
        dd      001db7106h, 098d220bch, 0efd5102ah, 071b18589h, 006b6b51fh&lt;br /&gt;
        dd      09fbfe4a5h, 0e8b8d433h, 07807c9a2h, 00f00f934h, 09609a88eh&lt;br /&gt;
        dd      0e10e9818h, 07f6a0dbbh, 0086d3d2dh, 091646c97h, 0e6635c01h&lt;br /&gt;
        dd      06b6b51f4h, 01c6c6162h, 0856530d8h, 0f262004eh, 06c0695edh&lt;br /&gt;
        dd      01b01a57bh, 08208f4c1h, 0f50fc457h, 065b0d9c6h, 012b7e950h&lt;br /&gt;
        dd      08bbeb8eah, 0fcb9887ch, 062dd1ddfh, 015da2d49h, 08cd37cf3h&lt;br /&gt;
        dd      0fbd44c65h, 04db26158h, 03ab551ceh, 0a3bc0074h, 0d4bb30e2h&lt;br /&gt;
        dd      04adfa541h, 03dd895d7h, 0a4d1c46dh, 0d3d6f4fbh, 04369e96ah&lt;br /&gt;
        dd      0346ed9fch, 0ad678846h, 0da60b8d0h, 044042d73h, 033031de5h&lt;br /&gt;
        dd      0aa0a4c5fh, 0dd0d7cc9h, 05005713ch, 0270241aah, 0be0b1010h&lt;br /&gt;
        dd      0c90c2086h, 05768b525h, 0206f85b3h, 0b966d409h, 0ce61e49fh&lt;br /&gt;
        dd      05edef90eh, 029d9c998h, 0b0d09822h, 0c7d7a8b4h, 059b33d17h&lt;br /&gt;
        dd      02eb40d81h, 0b7bd5c3bh, 0c0ba6cadh, 0edb88320h, 09abfb3b6h&lt;br /&gt;
        dd      003b6e20ch, 074b1d29ah, 0ead54739h, 09dd277afh, 004db2615h&lt;br /&gt;
        dd      073dc1683h, 0e3630b12h, 094643b84h, 00d6d6a3eh, 07a6a5aa8h&lt;br /&gt;
        dd      0e40ecf0bh, 09309ff9dh, 00a00ae27h, 07d079eb1h, 0f00f9344h&lt;br /&gt;
        dd      08708a3d2h, 01e01f268h, 06906c2feh, 0f762575dh, 0806567cbh&lt;br /&gt;
        dd      0196c3671h, 06e6b06e7h, 0fed41b76h, 089d32be0h, 010da7a5ah&lt;br /&gt;
        dd      067dd4acch, 0f9b9df6fh, 08ebeeff9h, 017b7be43h, 060b08ed5h&lt;br /&gt;
        dd      0d6d6a3e8h, 0a1d1937eh, 038d8c2c4h, 04fdff252h, 0d1bb67f1h&lt;br /&gt;
        dd      0a6bc5767h, 03fb506ddh, 048b2364bh, 0d80d2bdah, 0af0a1b4ch&lt;br /&gt;
        dd      036034af6h, 041047a60h, 0df60efc3h, 0a867df55h, 0316e8eefh&lt;br /&gt;
        dd      04669be79h, 0cb61b38ch, 0bc66831ah, 0256fd2a0h, 05268e236h&lt;br /&gt;
        dd      0cc0c7795h, 0bb0b4703h, 0220216b9h, 05505262fh, 0c5ba3bbeh&lt;br /&gt;
        dd      0b2bd0b28h, 02bb45a92h, 05cb36a04h, 0c2d7ffa7h, 0b5d0cf31h&lt;br /&gt;
        dd      02cd99e8bh, 05bdeae1dh, 09b64c2b0h, 0ec63f226h, 0756aa39ch&lt;br /&gt;
        dd      0026d930ah, 09c0906a9h, 0eb0e363fh, 072076785h, 005005713h&lt;br /&gt;
        dd      095bf4a82h, 0e2b87a14h, 07bb12baeh, 00cb61b38h, 092d28e9bh&lt;br /&gt;
        dd      0e5d5be0dh, 07cdcefb7h, 00bdbdf21h, 086d3d2d4h, 0f1d4e242h&lt;br /&gt;
        dd      068ddb3f8h, 01fda836eh, 081be16cdh, 0f6b9265bh, 06fb077e1h&lt;br /&gt;
        dd      018b74777h, 088085ae6h, 0ff0f6a70h, 066063bcah, 011010b5ch&lt;br /&gt;
        dd      08f659effh, 0f862ae69h, 0616bffd3h, 0166ccf45h, 0a00ae278h&lt;br /&gt;
        dd      0d70dd2eeh, 04e048354h, 03903b3c2h, 0a7672661h, 0d06016f7h&lt;br /&gt;
        dd      04969474dh, 03e6e77dbh, 0aed16a4ah, 0d9d65adch, 040df0b66h&lt;br /&gt;
        dd      037d83bf0h, 0a9bcae53h, 0debb9ec5h, 047b2cf7fh, 030b5ffe9h&lt;br /&gt;
        dd      0bdbdf21ch, 0cabac28ah, 053b39330h, 024b4a3a6h, 0bad03605h&lt;br /&gt;
        dd      0cdd70693h, 054de5729h, 023d967bfh, 0b3667a2eh, 0c4614ab8h&lt;br /&gt;
        dd      05d681b02h, 02a6f2b94h, 0b40bbe37h, 0c30c8ea1h, 05a05df1bh&lt;br /&gt;
        dd      02d02ef8dh&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252558/merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/</guid>
      <pubDate>Thu, 01 Apr 2004 16:52:22 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
    <item>
      <title>Re: Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252663/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252663</link>
      <description>&lt;span style="color: Blue;"&gt;It is a nice code, but LOOP instruction is slower then DEC/JNZ combination.&lt;/span&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252663/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252663</guid>
      <pubDate>Fri, 02 Apr 2004 07:46:52 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
    <item>
      <title>Re: Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252666/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252666</link>
      <description>: &lt;span style="color: Blue;"&gt;It is a nice code, but LOOP instruction is slower then DEC/JNZ combination.&lt;/span&gt;&lt;br /&gt;
: &lt;br /&gt;
I looked at the code and can't figure out what condition causes the loop instruction to finish.&lt;br /&gt;
&lt;br /&gt;
Thanks.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252666/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252666</guid>
      <pubDate>Fri, 02 Apr 2004 08:06:39 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
    <item>
      <title>Re: Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252702/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252702</link>
      <description>&lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by AsmGuru62 at  2004-4-2 10:47:7&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
: : &lt;span style="color: Blue;"&gt;It is a nice code, but LOOP instruction is slower then DEC/JNZ combination.&lt;/span&gt;&lt;br /&gt;
: : &lt;br /&gt;
: I looked at the code and can't figure out what condition causes the loop instruction to finish.&lt;br /&gt;
: &lt;br /&gt;
: Thanks.&lt;br /&gt;
: &lt;br /&gt;
&lt;span style="color: Blue;"&gt;This one:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
mov ecx, [ebp+12] ; string length
&lt;/pre&gt;&lt;br /&gt;
You should know that LOOP will loop &lt;img src="http://www.programmersheaven.com/images/Community/smile.gif" width="15" height="15" alt="" /&gt; until ECX becomes zero. Also, always check ECX BEFORE running that LOOP - if it is already zero! - you will have a loop counter of 100000000H - and it ain't fun! The REP instruction, on the other hand, does check for zero BEFORE looping, so:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
MOV ECX, 0
REP MOVSD
&lt;/pre&gt;&lt;br /&gt;
this code ^^^ will not cause any trouble. There will be no single MOVSD executed. Also, as I said, the pair&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
AGAIN:

; body of the loop

DEC  ECX
JNZ  AGAIN
&lt;/pre&gt;&lt;br /&gt;
is faster then LOOP.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252702/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252702</guid>
      <pubDate>Fri, 02 Apr 2004 10:46:14 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
    <item>
      <title>Re: Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252743/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252743</link>
      <description>&lt;br /&gt;
: this code ^^^ will not cause any trouble. There will be no single MOVSD executed. Also, as I said, the pair&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
: AGAIN:
: 
: ; body of the loop
: 
: DEC  ECX
: JNZ  AGAIN
: &lt;/pre&gt;&lt;br /&gt;
: is faster then LOOP.[/blue]&lt;br /&gt;
&lt;br /&gt;
; Copyright (c) 2002&lt;br /&gt;
; Pavel "EvilOne" Minayev&lt;br /&gt;
;&lt;br /&gt;
; Permission to use, copy, modify, distribute and sell this software&lt;br /&gt;
; and its documentation for any purpose is hereby granted without fee,&lt;br /&gt;
; provided that the above copyright notice appear in all copies and&lt;br /&gt;
; that both that copyright notice and this permission notice appear&lt;br /&gt;
; in supporting documentation.  Author makes no representations about&lt;br /&gt;
; the suitability of this software for any purpose. It is provided&lt;br /&gt;
; "as is" without express or implied warranty.&lt;br /&gt;
&lt;br /&gt;
I hope I did this right.&lt;br /&gt;
&lt;br /&gt;
bits 32&lt;br /&gt;
&lt;br /&gt;
segment .text&lt;br /&gt;
start:&lt;br /&gt;
   enter 0, 0&lt;br /&gt;
   ; load arguments into registers&lt;br /&gt;
    mov ebx, [ebp+16]    ; CRC-table&lt;br /&gt;
    ;mov ecx, [ebp+12]    ; string length&lt;br /&gt;
   &lt;br /&gt;
   MOV ECX, 0&lt;br /&gt;
   REP MOVSD&lt;br /&gt;
   mov esi, [ebp+08]    ; string&lt;br /&gt;
   ; initialize&lt;br /&gt;
   mov eax, 0xFFFFFFFF&lt;br /&gt;
   xor edx, edx&lt;br /&gt;
calcbyte:&lt;br /&gt;
   ; process a single byte:&lt;br /&gt;
   ; crc = table[(unsigned char)crc ^ byte] ^ (crc &amp;gt;&amp;gt; 8)&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   mov dl, al&lt;br /&gt;
   xor dl, [esi]&lt;br /&gt;
   shr eax, 8&lt;br /&gt;
   xor eax, [ebx+edx*4]&lt;br /&gt;
   inc esi&lt;br /&gt;
   DEC  ECX&lt;br /&gt;
   JNZ  calcbyte&lt;br /&gt;
&lt;br /&gt;
   ; clean up and return&lt;br /&gt;
   leave&lt;br /&gt;
   ret 16&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252743/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252743</guid>
      <pubDate>Fri, 02 Apr 2004 13:21:00 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
    <item>
      <title>Re: Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252753/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252753</link>
      <description>&lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by AsmGuru62 at  2004-4-2 14:14:58&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
: &lt;br /&gt;
: : this code ^^^ will not cause any trouble. There will be no single MOVSD executed. Also, as I said, the pair&lt;br /&gt;
: : &lt;pre class="sourcecode"&gt;
: : AGAIN:
: : 
: : ; body of the loop
: : 
: : DEC  ECX
: : JNZ  AGAIN
: : &lt;/pre&gt;&lt;br /&gt;
: : is faster then LOOP.[/blue]&lt;br /&gt;
: &lt;br /&gt;
: ; Copyright (c) 2002&lt;br /&gt;
: ; Pavel "EvilOne" Minayev&lt;br /&gt;
: ;&lt;br /&gt;
: ; Permission to use, copy, modify, distribute and sell this software&lt;br /&gt;
: ; and its documentation for any purpose is hereby granted without fee,&lt;br /&gt;
: ; provided that the above copyright notice appear in all copies and&lt;br /&gt;
: ; that both that copyright notice and this permission notice appear&lt;br /&gt;
: ; in supporting documentation.  Author makes no representations about&lt;br /&gt;
: ; the suitability of this software for any purpose. It is provided&lt;br /&gt;
: ; "as is" without express or implied warranty.&lt;br /&gt;
: &lt;br /&gt;
: I hope I did this right.&lt;br /&gt;
: &lt;br /&gt;
: bits 32&lt;br /&gt;
: &lt;br /&gt;
: segment .text&lt;br /&gt;
: start:&lt;br /&gt;
:    enter 0, 0&lt;br /&gt;
:    ; load arguments into registers&lt;br /&gt;
:     mov ebx, [ebp+16]    ; CRC-table&lt;br /&gt;
:     ;mov ecx, [ebp+12]    ; string length&lt;br /&gt;
:    &lt;br /&gt;
:    MOV ECX, 0&lt;br /&gt;
:    REP MOVSD&lt;br /&gt;
&lt;span style="color: Red;"&gt;&lt;strong&gt;I used it ^^^ as an example - you do not need these two lines.&lt;br /&gt;
In fact - these lines will make your code not working properly...&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
:    mov esi, [ebp+08]    ; string&lt;br /&gt;
:    ; initialize&lt;br /&gt;
:    mov eax, 0xFFFFFFFF&lt;br /&gt;
:    xor edx, edx&lt;br /&gt;
: calcbyte:&lt;br /&gt;
:    ; process a single byte:&lt;br /&gt;
:    ; crc = table[(unsigned char)crc ^ byte] ^ (crc &amp;gt;&amp;gt; 8)&lt;br /&gt;
:    &lt;br /&gt;
:    &lt;br /&gt;
:    mov dl, al&lt;br /&gt;
:    xor dl, [esi]&lt;br /&gt;
:    shr eax, 8&lt;br /&gt;
:    xor eax, [ebx+edx*4]&lt;br /&gt;
:    inc esi&lt;br /&gt;
:    DEC  ECX&lt;br /&gt;
:    JNZ  calcbyte&lt;br /&gt;
: &lt;br /&gt;
:    ; clean up and return&lt;br /&gt;
:    leave&lt;br /&gt;
:    ret 16&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252753/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252753</guid>
      <pubDate>Fri, 02 Apr 2004 14:13:39 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
    <item>
      <title>Re: Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252767/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252767</link>
      <description>:&lt;br /&gt;
: :    MOV ECX, 0&lt;br /&gt;
: :    REP MOVSD&lt;br /&gt;
: &lt;span style="color: Red;"&gt;&lt;strong&gt;I used it ^^^ as an example - you do not need these two lines.&lt;br /&gt;
: In fact - these lines will make your code not working properly...&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I'll give what I think this code is doing.&lt;br /&gt;
&lt;br /&gt;
The mov ebx points to the CRC table&lt;br /&gt;
String length maybe is the length of the file I want to do the CRC of&lt;br /&gt;
&lt;br /&gt;
Am I close.&lt;br /&gt;
&lt;br /&gt;
bits 32&lt;br /&gt;
&lt;br /&gt;
segment .text&lt;br /&gt;
start:&lt;br /&gt;
   enter 0, 0&lt;br /&gt;
   ; load arguments into registers&lt;br /&gt;
    mov ebx, [ebp+16]    ; CRC-table&lt;br /&gt;
    mov ecx, [ebp+12]    ; string length&lt;br /&gt;
   &lt;br /&gt;
   mov esi, [ebp+08]    ; string&lt;br /&gt;
   ; initialize&lt;br /&gt;
   mov eax, 0xFFFFFFFF&lt;br /&gt;
   xor edx, edx&lt;br /&gt;
calcbyte:&lt;br /&gt;
   ; process a single byte:&lt;br /&gt;
   ; crc = table[(unsigned char)crc ^ byte] ^ (crc &amp;gt;&amp;gt; 8)&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   mov dl, al&lt;br /&gt;
   xor dl, [esi]&lt;br /&gt;
   shr eax, 8&lt;br /&gt;
   xor eax, [ebx+edx*4]&lt;br /&gt;
   inc esi&lt;br /&gt;
   DEC  ECX&lt;br /&gt;
   JNZ  calcbyte&lt;br /&gt;
&lt;br /&gt;
   ; clean up and return&lt;br /&gt;
   leave&lt;br /&gt;
   ret 16&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252767/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252767</guid>
      <pubDate>Fri, 02 Apr 2004 15:41:49 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
    <item>
      <title>Re: Merge a fast CRC32 snippet with it's CRC32 table help needed</title>
      <link>http://www.programmersheaven.com/mb/x86_asm/252558/252962/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252962</link>
      <description>: :&lt;br /&gt;
: : :    MOV ECX, 0&lt;br /&gt;
: : :    REP MOVSD&lt;br /&gt;
: : &lt;span style="color: Red;"&gt;&lt;strong&gt;I used it ^^^ as an example - you do not need these two lines.&lt;br /&gt;
: : In fact - these lines will make your code not working properly...&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
: &lt;br /&gt;
: I'll give what I think this code is doing.&lt;br /&gt;
: &lt;br /&gt;
: The mov ebx points to the CRC table&lt;br /&gt;
: String length maybe is the length of the file I want to do the CRC of&lt;br /&gt;
: &lt;br /&gt;
: Am I close.&lt;br /&gt;
: &lt;br /&gt;
: bits 32&lt;br /&gt;
: &lt;br /&gt;
: segment .text&lt;br /&gt;
: start:&lt;br /&gt;
:    enter 0, 0&lt;br /&gt;
:    ; load arguments into registers&lt;br /&gt;
:     mov ebx, [ebp+16]    ; CRC-table&lt;br /&gt;
:     mov ecx, &lt;span style="color: Red;"&gt;your data size goes here&lt;/span&gt;&lt;br /&gt;
:    &lt;br /&gt;
:    mov esi, &lt;span style="color: Red;"&gt;address of a first byte of your data&lt;/span&gt;&lt;br /&gt;
:    ; initialize&lt;br /&gt;
:    mov eax, 0xFFFFFFFF&lt;br /&gt;
:    xor edx, edx&lt;br /&gt;
: calcbyte:&lt;br /&gt;
:    ; process a single byte:&lt;br /&gt;
:    ; crc = table[(unsigned char)crc ^ byte] ^ (crc &amp;gt;&amp;gt; 8)&lt;br /&gt;
:    &lt;br /&gt;
:    &lt;br /&gt;
:    mov dl, al&lt;br /&gt;
:    xor dl, [esi]&lt;br /&gt;
:    shr eax, 8&lt;br /&gt;
:    xor eax, [ebx+edx*4]&lt;br /&gt;
:    inc esi&lt;br /&gt;
:    DEC  ECX&lt;br /&gt;
:    JNZ  calcbyte&lt;br /&gt;
: &lt;br /&gt;
:    ; clean up and return&lt;br /&gt;
:    leave&lt;br /&gt;
:    ret 16&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/x86_asm/252558/252962/re-merge-a-fast-crc32-snippet-with-its-crc32-table-help-needed/#252962</guid>
      <pubDate>Sun, 04 Apr 2004 06:58:29 -0700</pubDate>
      <category>x86 Assembly</category>
    </item>
  </channel>
</rss>