News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DEFINE_GUID

Started by Ficko, December 03, 2009, 10:43:29 AM

Previous topic - Next topic

Ficko

This maybe not that usefull for assamblers but other languages are often using simille macros and I just playing with SIMD. :bg


.686p
.model flat
.xmm
;; ===========================================================================
PGUID TYPEDEF PTR GUID
GUID STRUCT
    Data1  dd ?
    Data2  dw ?
    Data3  dw ?
    Data4  dd ?
    Data5 dd ?
GUID ENDS
; ===========================================================================
.code
; =============== S U B R O U T I N E =======================================
DEFINE_GUID proc near public lpGUID:PGUID,l1:DWORD,w1:WORD,w2:WORD,b1:BYTE,b2:BYTE,b3:BYTE,b4:BYTE,b5:BYTE,b6:BYTE,b7:BYTE,b8:BYTE
  mov   eax, dword ptr[lpGUID]
  movq  xmm0, qword ptr [l1]
  movd  xmm1, dword ptr [w2]
  psllq  xmm1, 48
  por   xmm0, xmm1
  movq  qword ptr [eax], xmm0
  movups  xmm0, xmmword ptr [b1]
  movups  xmm1, xmmword ptr [b5]
  packssdw  xmm0, xmm1
  packuswb  xmm0, xmm1
  movq  qword ptr [eax.GUID.Data4], xmm0
  ret   30h
DEFINE_GUID endp
end