• 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: NSData questions (including Altivec)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData questions (including Altivec)


  • Subject: Re: NSData questions (including Altivec)
  • From: Nicko van Someren <email@hidden>
  • Date: Mon, 20 Sep 2004 16:08:15 +0100

On 20 Sep 2004, at 09:20, Paul Sargent wrote:

1) Does anybody know whether NSData guarantees to allocate memory for it's buffer with 16-byte alignment so that altivec code can be used on it? I'm assuming it uses malloc() for it's allocation, and malloc() appears to guarantee this.

There is no such guarantee in the documentation so I would suggest that even if it appears to do the right thing that you don't count on it.


2) Is it against the spirit of NSData to be modifying the data in the buffer via the pointer given by the bytes method? i.e. When you use a NSMuableData, is it just the attributes of the buffer which gain mutability or is it the buffer itself as-well?

I believe that you are explicitly allowed to modify the bytes in the buffer pointed to by the result of the mutableBytes message. As far as I can tell the real difference between NSData and NSMutableData is in the behaviour of the copy message, which simply does a retain on the former class but actually copies data for the later.


3) When using SetLength, IncreaseLength and AppendBytes, I would assume that it's possible for the buffer to change location. Therefore it's best to use the mutableBytes method to get a new pointer whenever there's a possibility it changed. Correct?

Yes, that's right.

	Nicko

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSData questions (including Altivec)
      • From: "Sean McBride" <email@hidden>
References: 
 >NSData questions (including Altivec) (From: Paul Sargent <email@hidden>)

  • Prev by Date: Re: -NSView setHidden: in 10.2
  • Next by Date: Re: -NSView setHidden: in 10.2
  • Previous by thread: NSData questions (including Altivec)
  • Next by thread: Re: NSData questions (including Altivec)
  • Index(es):
    • Date
    • Thread