GarboBombo Posted July 15, 2018 Share Posted July 15, 2018 I think the title is self explanatory, but if not I just need a way of creating a structure has no padding if an array of bytes is less than 4. Although I know this specific and not at all efficient the task I am trying to accomplish is pretty stern when it comes to data structures. If there are any other alternatives for data structures when pertaining to specific size of variables I would be more than grateful to use that. Just as an example I'll show a little bit of code to explain what my problem is. #include <Misc.au3> #include <Math.au3> #include <WinAPI.au3> $examplestruct = "BYTE base;" $examplestruct&= "FLOAT s;" $examplestruct&= "FLOAT d;" $examplestruct&= "FLOAT a;" $example = DllStructCreate($examplestruct) MsgBox(1,"Structure Size Problem","Target size of structure: 13 bytes"&@CRLF&"Actual size of structure:"&DllStructGetSize($example)&" bytes") Link to comment Share on other sites More sharing options...
RTFC Posted July 15, 2018 Share Posted July 15, 2018 To align is divine... #include <Misc.au3> #include <Math.au3> #include <WinAPI.au3> $examplestruct = "align 1;BYTE base;" $examplestruct&= "FLOAT s;" $examplestruct&= "FLOAT d;" $examplestruct&= "FLOAT a;" $example = DllStructCreate($examplestruct) MsgBox(1,"Structure Size Problem","Target size of structure: 13 bytes"&@CRLF&"Actual size of structure:"&DllStructGetSize($example)&" bytes") My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
GarboBombo Posted July 15, 2018 Author Share Posted July 15, 2018 1 minute ago, RTFC said: To align is divine... #include <Misc.au3> #include <Math.au3> #include <WinAPI.au3> $examplestruct = "align 1;BYTE base;" $examplestruct&= "FLOAT s;" $examplestruct&= "FLOAT d;" $examplestruct&= "FLOAT a;" $example = DllStructCreate($examplestruct) MsgBox(1,"Structure Size Problem","Target size of structure: 13 bytes"&@CRLF&"Actual size of structure:"&DllStructGetSize($example)&" bytes") Truly! Thank you. Link to comment Share on other sites More sharing options...
RTFC Posted July 15, 2018 Share Posted July 15, 2018 You're welcome, and welcome to the forums. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
water Posted July 15, 2018 Share Posted July 15, 2018 BTW GarboBombo, do not quote the post, the posters know what they have written Simply add the reply at the end of the thread and click the "Submit Reply" button. Quoting posts only clutters the thread. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now