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 » Developing U++ » U++ Developers corner » Endian specific source changes, for Universal support.
Endian specific source changes, for Universal support. [message #7018] Fri, 08 December 2006 02:33 Go to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

On OsX in particular, you can produce Universal binaries, applications with both Intel and PPC compiled code. This is enabled by giving gcc "-arch intel -arch ppc".

However, there are parts of U++ that currently are in #ifdef ENDIAN.

Have you considered changing said code for endian independant code, like bit-shifts etc, or at worst, use OS given endian functions like ntohl() etc.

There do not appear to be too many endian related calls in UPP.
Re: Endian specific source changes, for Universal support. [message #7020 is a reply to message #7018] Fri, 08 December 2006 06:34 Go to previous messageGo to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

So it seem OsX's gcc supply some defines when compiling for both architectures. I can, for example, use:

#ifdef __BIG_ENDIAN__
#define flagPPC
#undef flagX86
#endif

#ifdef __LITTLE_ENDIAN__
#undef flagPPC
#define flagX86
#endif

in Core.h, and let it pick the CPU type automatically.

I have been playing around with "Build methods" which I have largely ignored until now, and I see the potential there. Instead of any code change, I can define GCC32 method, GCC32_Intel, and GCC32_Universal methods, and specify the compile options needed.

However, what does seem to be missing is the linking flags.

Very nice though.
Re: Endian specific source changes, for Universal support. [message #7025 is a reply to message #7018] Fri, 08 December 2006 09:25 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I always thought that for universal binaries, sources are compiled twice....

Mirek
Re: Endian specific source changes, for Universal support. [message #7026 is a reply to message #7025] Fri, 08 December 2006 09:32 Go to previous messageGo to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

Correct, but specify both options and gcc will do both passes for you automatically. But it is possible to completely compile both archs separately and then join them at the end using lipo.

Re: Endian specific source changes, for Universal support. [message #7031 is a reply to message #7026] Fri, 08 December 2006 11:12 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
lundman wrote on Fri, 08 December 2006 03:32


Correct, but specify both options and gcc will do both passes for you automatically. But it is possible to completely compile both archs separately and then join them at the end using lipo.




I would rather vote for this option. While debugging, you will be using just one mode anyway.... And for release, this is not that problem, moreover TheIDE can use lipo as well (in future).

Mirek
Previous Topic: uvs2 as "public application"
Next Topic: Benchmarking U++
Goto Forum:
  


Current Time: Sat May 04 04:15:13 CEST 2024

Total time taken to generate the page: 0.03309 seconds