flat assembler
Message board for the users of flat assembler.
Index
> Main > How to embed 32 times one structure into another structure? |
Author |
|
ProMiNick 27 May 2023, 12:09
Code: macro array size,type,[value] { common local index index = 0 forward index = index + 1 common match ,value \{ index = 0 \} if index>size \can\`\t \fit \in type[size] end if if size forward type value common end if repeat size-index type end repeat } macro arrayoverload [type] { macro type definition& \{ match [size] values, definition: \\{ match vals:,values \\\{ array size,type,vals \\\} match :,values \\\{ array size,type \\\} overloaded equ \\} match =overloaded,overloaded \\{ type definition \\} restore overloaded\} struc type definition& \{ virtual . type end virtual type definition \} } Code: arrayoverload VkMemoryType,VkMemoryHeap struct VkPhysicalDeviceMemoryProperties memoryTypeCount dd ? memoryTypes VkMemoryType[VK_MAX_MEMORY_TYPES]; also thou could init any defaults within <> for any array item memoryHeapCount dd ? memoryHeaps VkMemoryHeap[VK_MAX_MEMORY_TYPES] ends |
|||
27 May 2023, 12:09 |
|
NETSTALKER 27 May 2023, 13:42
ProMiNick wrote:
Thank you very much. It looks beautiful. But is there a way to solve the issue with built-in methods? Maybe not so beautiful, but so that you don't need to introduce new entities - macros. _________________ SEARCH INTERESTING FILES |
|||
27 May 2023, 13:42 |
|
ProMiNick 27 May 2023, 15:28
not so beautifyl - peace of cake (that is legacy fasm solution for arrays):
Code: struct VkPhysicalDeviceMemoryProperties memoryTypeCount dd ? memoryTypes db sizeof.VkMemoryType*VK_MAX_MEMORY_TYPES dup (?) memoryHeapCount dd ? memoryHeaps db sizeof.VkMemoryHeap*VK_MAX_MEMORY_TYPES dup (?) ends |
|||
27 May 2023, 15:28 |
|
NETSTALKER 27 May 2023, 16:18
ProMiNick wrote: not so beautifyl - peace of cake (that is legacy fasm solution for arrays): Thank you. I did the same myself. It's worse, but it works. Thank you very much. Your previous example may contain an error. My program crashed without an message about error. _________________ SEARCH INTERESTING FILES |
|||
27 May 2023, 16:18 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.