• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about NSRange on the G5 and the future sizeof(int).
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about NSRange on the G5 and the future sizeof(int).


  • Subject: Re: Question about NSRange on the G5 and the future sizeof(int).
  • From: Eric Dahlman <email@hidden>
  • Date: Sun, 13 Jul 2003 16:18:10 -0500

On Sunday, July 13, 2003, at 02:29 PM, Greg Titus wrote:

If this turns out to be true then the original questioner will be able to just go ahead and continue to use NSRange, since its structure members and macros/functions all work on and return ints, and those will automatically be 64-bits wide when pointers are 64-bits wide.

Now I have to admit that I have not looked at the binary API for 64 bit PowerPC but if it is anything like the other 64 bit architecture I program for any assumption about int and void* having the same size is totally unfounded. Even on the same processor at the same time.

The short of it is that unless you are accessing more than 4G of memory 64 bit pointers are at least half dead weight, and this is the situation for 98% of the programs running on a given machine. This is a significant performance problem so the processor supports two addressing models where one has a 32 bit address space and the other a 64 bit address space. In the 32 bit mode pointers are all 32 bits long and in 64 bit mode they are 64 bit long - but ints and long ints do not change. This is all determined by a compiler flag and it would be entirely reasonable to assume that you could recompile a program that outgrew its 32 bit address space to use the 64 bit address space with a simple recompile with a different flag. Now if you al playing non-portable games of sticking pointers into ints you are gonna lose.

I find it is always healthy to ask myself "would this port to the AS/400?" which had huge (I believe 16 word) pointers and 32 bit integers.

I guess that I will have to read the PowerPC 64 bit architecture manual next week so that I won't be talking out of my you know what :-) Anybody have a link to the PDF?

-Eric
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Question about NSRange on the G5 and the future sizeof(int).
      • From: Shawn Erickson <email@hidden>
References: 
 >Re: Question about NSRange on the G5 and the future sizeof(int). (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: Question about NSRange on the G5 and the future sizeof(int).
  • Next by Date: Re: Question about NSRange on the G5 and the future sizeof(int).
  • Previous by thread: Re: Question about NSRange on the G5 and the future sizeof(int).
  • Next by thread: Re: Question about NSRange on the G5 and the future sizeof(int).
  • Index(es):
    • Date
    • Thread