Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How does one determine the byte order of the RGBA struct?
How does one determine the byte order of the RGBA struct? [message #47974] Sun, 30 April 2017 06:59 Go to next message
ptkacz is currently offline  ptkacz
Messages: 89
Registered: March 2017
Member
Hi All,

How does one programatically determine the byte order of the RBGA struct?


Peter
Re: How does one determine the byte order of the RGBA struct? [message #47975 is a reply to message #47974] Sun, 30 April 2017 12:23 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
What do you need it for?
You can try to use offsetof:
if (offsetof(RGBA, a) == 0){
   [...]
}
Re: How does one determine the byte order of the RGBA struct? [message #47993 is a reply to message #47974] Wed, 03 May 2017 04:51 Go to previous message
ptkacz is currently offline  ptkacz
Messages: 89
Registered: March 2017
Member
Thanks! That's a neat macro.

As for why, depending on what operations are to be applied to an RGBA structure, one might need to know how data is ordered. Similarly, if one ports code from one platform to another, how does one know if there's a byte ordering change, etc?

When I started looking at the definition of RGBA, there's a compiler directive of something like, "#if bla" then order RGBA this way, else, order the data this way. Since "bla" doesn't appear to be defined within the file locally, there's the question of what order is the data stored in?


Peter

PS: "bla" is a place holder and does not represent actual implemented C++ U++ code. Wink

[Updated on: Wed, 03 May 2017 04:52]

Report message to a moderator

Previous Topic: Layout editor, where's the ColorPusher and other magical types???
Next Topic: C++11 issue under Linux
Goto Forum:
  


Current Time: Thu Apr 18 06:51:32 CEST 2024

Total time taken to generate the page: 0.01300 seconds