What happens to .w and .l ?

Everything else that doesn't fall into one of the other PB categories.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

What happens to .w and .l ?

Post by va!n »

For my actual project i have defined all my datas as long to the datasection and read all them as long! All the values in the datasection are positiv and no value is bigger as 16000! To save some bytes (maybe 1 alignment, also 512 bytes) to the exe, i tried to define the complete data section to WORD and read them as word.

Normaly each .l value will be stored in 4 bytes and each .w value will be stored in 2 bytes - so the final exe should be possible smaller when using only .w instead storing all the data as long. In my project this is only theoretical and this is the point, i am very confused - because i have strange filesize results here!

filesize: 4096 bytes <-- All datas as WORD !!!!
filesize: 3584 bytes <-- All datas as LONG !!!!

Why is the version, using only longs - 1 alignment (512 bytes) smaller? I have tried to debug the datas for both versions and both version returning all datas correct! Atm this is a bit unlogical for me!
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

While taking a look to both exe versions i noticed something at offset $600 - In the WORD based version some code is used from $600 to $612 and then all filed by zero up to $800 (also nearly one complete PE alingment)

When taking a look to the LONG based version, here the same topic code will end at $5A8 - so the next stuff will be begin at $600 instead at $800 like the WORD version! (same code)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Both snippet please. You can also take a look to generated asm code to see if something looks wrong..
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

i think i will take a clother look to the ASM output this afternoon when having some time for it :wink:
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Something related to the alignment macro?
Post Reply