Author Topic: or, and (||, &&) in ifidn macro  (Read 3900 times)

nobody

  • Guest
or, and (||, &&) in ifidn macro
« 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

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2373
  • Country: us
Re: or, and (||, &&) in ifidn macro
« Reply #1 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

nobody

  • Guest
Re: or, and (||, &&) in ifidn macro
« Reply #2 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

netman

  • Guest
Re: or, and (||, &&) in ifidn macro
« Reply #3 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