News:

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

Main Menu

help

Started by mabdelouahab, March 11, 2015, 07:20:17 PM

Previous topic - Next topic

mabdelouahab

rrr314159
Intel(R) Pentium(R) 4 CPU 2.26GHz

   NegAnd: 5 5 6 6 6
DecNotAnd: 6 6 6 6 6
   BsfShl: 7 8 7 7 7
   Popcnt: POPCNT Not Supported By This CPU

Press any key to continue ...

Dave, you forgot to return procedure "IsP2Byte_DecNotAnd " after you modify it
IsP2Byte_DecNotAnd PROC dwVal:DWORD

    movzx   edx,byte ptr [esp+4]
    xor     eax,eax
    mov     dh,dl
;   dec     dh
;   not     dh
neg dh
  ;  and     dh,dl
    .if !ZERO?
and dh,dl
        .if dl==dh
            mov     al,1
        .endif
    .endif
    ret     4

IsP2Byte_DecNotAnd ENDP


Intel(R) Pentium(R) 4 CPU 2.26GHz

   NegAnd: 5 6 6 5 5
DecNotAnd: 7 8 8 8 7
   BsfShl: 8 7 7 7 7
   Popcnt: POPCNT Not Supported By This CPU

Press any key to continue ...

:t

rrr314159

Actually I wasn't thinking so much of the time (who cares about a clock cycle or two?) but it's a little cleaner. After all dec-not is precisely identical to neg, which is usually defined "take two's complement and add one". And, make the branch as soon as possible. But, just nit-picking; obviously my social life must be slow at the moment ... ;)
I am NaN ;)

dedndave

oops! good catch   :t

updated attachment and timings in Reply #14

sinsi

Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz

   NegAnd: 1 1 1 1 1
DecNotAnd: 2 2 2 2 2
   BsfShl: 2 2 2 2 2
   Popcnt: 0 0 0 0 0

:biggrin:
Tá fuinneoga a haon déag níos fearr :biggrin:

dedndave