NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: nobody on February 01, 2009, 07:27:49 AM

Title: or, and (||, &&) in ifidn macro
Post by: nobody on February 01, 2009, 07:27:49 AM
Hi,

Is there a way in nasm to use or/and in ifidn macro?

E.g.

%ifidn %1,rax || %1,rbx
     ....
%endif

Thanks,
Csaba
Title: Re: or, and (||, &&) in ifidn macro
Post by: Frank Kotler on February 01, 2009, 07:27:59 PM
I don't think so (I'm not a very sophisticated macro user). I think you'll have to do:

%ifidn %1, rax
; some code
%endif
%ifidn %1, ebx
; same code
%endif

Nest 'em for "and", of course. You might want %ifidni to catch uppercase, too.

Best,
Frank
Title: Re: or, and (||, &&) in ifidn macro
Post by: nobody on February 04, 2009, 12:26:48 PM
Thanks,

Actually I did what you have written but I was curious if it is possible to do it as in other languages (usually).

Thanks,
Csaba
Title: Re: or, and (||, &&) in ifidn macro
Post by: netman on March 20, 2010, 01:53:06 AM
why not do like this
Code: [Select]
%macro some_macro
  ; some code
%endif

%ifidn this, that
  some_macro
%elsifidn other_this, other_that
  some macro
%endif