flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > How to use macro return val. in stdcall?/LocalVariable size? |
Author |
|
Tomasz Grysztar 27 Dec 2006, 14:41
1. No, it's not possible without a modification to either "pushd" or "stdcall" macro. See also http://board.flatassembler.net/topic.php?t=4159
2. The "and 0xFFFFFFFF" is the only correct way. In fact I'm thinking about making it signalize overflow error when you try to shift some bits beyond the available range, this would be more consistent with overall expression calculator's behavior... |
|||
27 Dec 2006, 14:41 |
|
Goplat 27 Dec 2006, 16:06
Fr3m3n wrote: In this macro i need _hash variable to act like dword - bits shifted beyond 31 bit must be 'lost'. 'and 0xFFFFFFFF' does the trick, but imho this is ugly. _hash = (((_hash shl 5) or (_hash shr 27)) and 0xFFFFFFFF)+c This is equivalent but shorter. Actually, there's still a bug here - a small possibility that adding c could carry into bit 32. You should add c first, then do the and. _hash = (((_hash shl 5) or (_hash shr 27)) + c) and 0xFFFFFFFF |
|||
27 Dec 2006, 16:06 |
|
Fr3m3n 27 Dec 2006, 23:20
Tomasz Grysztar wrote:
What about 'local a:DWORD' 'local b:BYTE' with default size of QWORD? This will maintain compatibility with old sources. Is this what you are thinking of? Goplat wrote: Assembler constants/variables are always qwords but you could use the distributive law to get rid of one of the ands. You are right, thanks. |
|||
27 Dec 2006, 23:20 |
|
Tomasz Grysztar 27 Dec 2006, 23:25
Fr3m3n wrote: What about 'local a:DWORD' 'local b:BYTE' with default size of QWORD? This will maintain compatibility with old sources. The DWORD in "local a:DWORD" defines the size of data labelled by "a", not the size of (address) value stored in "a". |
|||
27 Dec 2006, 23:25 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.