flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Fasm optimization question about expression calculating |
Author |
|
Tomasz Grysztar 27 Jun 2005, 14:19
All values are stored internally as 64-bit signed values, and when they have to be assigned to some specific task that needs the value of smaller size (like definition of the data byte), the value is checked to fit in the range of that smaller size. However the both signed and unsigned ranges are allowed, so you can define bytes from -128 up to 255. And so when you write:
Code: db -1 the -1 is stored internally as 0FFFFFFFFFFFFFFFFh (signed 64-bit value) and then converted into signed byte 0FFh. And when you write: Code: db 255 it is stored internally as 0FFh in 64 bits, and then cut down to unsigned byte. Now when you write: Code: db not 255 from the context fasm assumes you mean negating the byte value. However if it just negated the full 64 bit value on which it operates, the result would be 0FFFFFFFFFFFFFF00h, which is the negative value that doesn't even fit into byte. For this reason there is the special handling of NOT. However I've just noticed that for XOR the above code is completely unecessary, as it does anyway exactly the same as if straightforward XORing was done. I should change it to the simple one. |
|||
27 Jun 2005, 14:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.