News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

compile-time logical operators

Started by megavlad, May 06, 2025, 09:05:54 AM

Previous topic - Next topic

megavlad

The compile-time operator AND, OR, NOT, and XOR are bitwise operator.
Does MASM support compile-time logical operators?

The goal would be to do use them in macros, like:

foo macro arg1, arg2
    if arg1 eq 11 && arg2 eq 22
        ; ...
    endm
endm

Quin

Edit: I didn't read the topic title closely. You're talking about compile time operators.

sinsi

MASM uses AND, not &&.

QuoteEQ - Returns true (-1) if expression1 equals expression2, or returns false (0) if it does not.
In this case, AND is logical
foo macro arg1, arg2
    if (arg1 eq 11) and (arg2 eq 22)
        ; ...
    endm
endm
I added the brackets for clarity.

NoCforMe

Assemble-time, not compile-time (same difference but still), but yes, those operators are usable.
Very handy.
32-bit code and Windows 7 foreva!

megavlad

Quote from: sinsi on May 06, 2025, 09:43:55 AMfoo macro arg1, arg2
    if (arg1 eq 11) and (arg2 eq 22)
        ; ...
    endm
endm

Thanks

daydreamer

I seen old 13h demo code,how powerful compile time stuff can be used to compile time create several palettes of blue fire,red fire,green fire etc ,in source file,with conditional jump to desired palette to compile

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding