flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
baldr 13 Dec 2013, 03:17
DimonSoft,
That depends. If you simply need to redefine symbolic constant, you may use somethine like this: Code: struc reequ [val] { common restore . . equ val } Code: struc reEqu [val] { common match _val, val \{ . reequ _val \} match , val \{ . reequ \} } Another way is to use symbolics' stack directly: put a sentinel value in advance, then simply use equ to push values; pop them with restore. |
|||
![]() |
|
l_inc 13 Dec 2013, 09:44
DimonSoft
Quote: In my case I don't need the previous values of the constant and I'd better decrease the amount of memory used by the preprocessor I completely understand your need to clean up, and I also try to clean up after myself, but it empirically turns out, that you cannot decrease the memory consumption by restoring the values of symbolic constants. I'm not aware of whether fasm frees any stack memory, but even if it does the very usage of any additional directive in the source increases the memory consumption, just because fasm does a straightforward textual expansion of macros. Thus to sum up reequ provided by baldr is a nice macro and I use it extensively, but every time you invoke an additional restore you make fasm consume more memory than you could free from the symbolic constant stack. _________________ Faith is a superposition of knowledge and fallacy |
|||
![]() |
|
l_inc 13 Dec 2013, 09:55
baldr
Quote: When val can refer to symbol being redefined, match should be used to expand it beforehand This one is a bit unfortunate because of the constant expanding behaviour of match. In order to have a no-strings-attached-additional-variable, you could either use irp {common } or replace your reequ with an analogous redefine instead. I prefer to use the following way: Code: struc reequ [val] { common tmp equ val restore . . equ tmp restore tmp } It does not look that nice and cannot be rewritten into a single line, but it also consumes a bit less memory. _________________ Faith is a superposition of knowledge and fallacy |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.