flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Iterating through string / virtual & load performance |
Author |
|
revolution 15 Feb 2012, 06:02
I don't know of any other way than the virtual thing. However, somehow, I expect this might apply under the "premature optimisation" category. Get it working first, then get it fast, right? If, after it is working, it is too slow then consider writing an exe file to do it instead (I don't know your exact context so I'm not sure if this is possible for you).
As for random values: That it is not possible. AFAIK the best you could achieve is pseudo-random with the timestamp (%t) as a seed. |
|||
15 Feb 2012, 06:02 |
|
yoshimitsu 15 Feb 2012, 06:36
That's the problem :P
Because if I do it this way I don't think there will be much room for optimizations. Therefore I asked before writing the full macro, because I figured I might need to fully recode it elsewise. It should just be a small macro at assembly stage to write the byte-arrays I need in a more comfortable way. Take the string, replace every for example b-letters with a random number between 1 and 5 and save the other ones normally. With randoms I actually meant using the timestamp-directive, but I still need to see how I actually should handle it to get it as close as to a trivial rand-function |
|||
15 Feb 2012, 06:36 |
|
revolution 15 Feb 2012, 07:01
A simple PRNG like an LCG would be simple to implement.
|
|||
15 Feb 2012, 07:01 |
|
yoshimitsu 15 Feb 2012, 07:16
Already saw some posts regarding that, thanks.
So should I just use that virtual | db string | end virtual in a loop or is there any other, maybe better way of checking every single character of a string and saving it afterwards? |
|||
15 Feb 2012, 07:16 |
|
revolution 15 Feb 2012, 09:48
It occurs to me that you could do in place replacement:
Code: s: db _str repeat $-s load byte x from s+%-1 <manipulate> store x byte at s+%-1 end repeat |
|||
15 Feb 2012, 09:48 |
|
yoshimitsu 15 Feb 2012, 10:22
I believe you're right, that should do the trick.
Thank you :) |
|||
15 Feb 2012, 10:22 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.