Assignment of members based on input.
The main reason for these constructs is to optimize code based on type. The
typeid operator is in C++ part of the standard library header
typeinfo.
The Asmc implementation is similar and used as type identification for macro arguments. It's a text macro and may be used for direct branching in a class or a regular macro. This simplify and also gives a more accurate type definition than TYPE and OPATTR that is often used for the same purpose.
The preprocessor also handles real math so this opens up more possibilities for doing the same as more advanced compilers do. This also means that more code is moved to the header files but less needed on the user end.
As an example the
ARGB color constants are defined as a DWORD and expanded to a
D3DCOLORVALUE struct of 4 float values. The input will then in most cases be immediate values:
.new color:D3DCOLORVALUE(Black, 0.0)
The code for each float:
mov eax,_1
and eax,sc_redMask
shr eax,sc_redShift
cvtsi2ss xmm0,eax
divss xmm0,255.0
movss [rcx].D3DCOLORVALUE.r,xmm0
Or the simplified version:
%mov [rcx].D3DCOLORVALUE.r, @CatStr(%((_1 and sc_redMask) shr sc_redShift), <.0>) / 255.0