flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > trying to make this with macros

Author
Thread Post new topic Reply to topic
DC740



Joined: 01 Oct 2004
Posts: 74
Location: Argentina
DC740
hello, I'm trying to do a port from a C source code, and I want to translate this:

#define crc32(c, b) (crc_32_tab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8 ))

to FASM macros, has anybody already done this?? is this posible using macros or I should make it with code???

thanx for your time

(I used the search function in the forum and I didn't find any interesting topics about this, of course maybe I'm wrong)

_________________
[img]http://img194.imageshack.us/img194/9575/argentino7no3ym.gif
[/img]
Post 12 Apr 2006, 01:59
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
How about:
http://board.flatassembler.net/topic.php?t=2568

This can be done both with macros and in the code - depending on what you want.
Post 12 Apr 2006, 06:38
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
next time more descriptive thread name please
Post 12 Apr 2006, 07:39
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
Code:
;out:
;    eax = result
macro crc32 c, b {
    mov eax, c
    xor eax, b
    and eax, $0FF
    mov eax, dword[crc_32_tab+eax*4]
    mov ebx, c
    shr ebx, 8
    xor eax, ebx
}   
;---
    


it's very late so my conversion may be wrong, and i have not tested in fasm but i'm sure it will compile fine as long as crc_32_tab is defined

_________________
redghost.ca
Post 13 Apr 2006, 08:13
View user's profile Send private message AIM Address MSN Messenger 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 © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.