Jump to content
  • Advertisement
Sign in to follow this  
Leo_E_49

Structure Packing

This topic is 4883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Quote:
Original post by Leo_E_49
Well I assume that since I prototyped the model loader on the PC, it should be in a little endian format anyway. Shouldn't it?
Yes.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by doynax
Quote:
Original post by Leo_E_49
How do I pack structures in gcc for Linux? I'm trying to port my model loader to the PS2 and I can't seem to figure it out.
Packing the structure tightly almost certainly results in misaligned structure members, and x86s are virtually the only modern processors capable of handling unaligned accesses.

And even then, it's slower than aligned accesses

Share this post


Link to post
Share on other sites
Memory access performance is hardly of the essence here, when writing routines that load data from file.

As far as I understand, the OP wants to pack these structures so that they can be read in directly from a binary file. These structures would probably serve only as temporaries in the loader, that then translates the data for use in appropriate, high performance, run-time formats.

Share this post


Link to post
Share on other sites
Yep, that's true. Well, I'm not sure I'll have time to convert them, at the moment I'm using the same thing for rendering, it still works real-time so I'm happy.

My only problem was issues with packing not appearing to work right on the PS2. Instead of reading structures, I now read their members in directly one by one, it seems to work. I'll post if I have any more problems.

Thank you everyone for your help. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!