• 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: drawing an array of pixels to the screen
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing an array of pixels to the screen


  • Subject: Re: drawing an array of pixels to the screen
  • From: David Spooner <email@hidden>
  • Date: Mon, 12 Nov 2007 15:17:38 -0700

On 12-Nov-07, at 2:11 PM, John Stiles wrote:

The generated code is the same. The [][] syntax is simply syntactic sugar which hides the multiplication.

I believe this is only true when the array dimensions are known. For T a[H][W], a[y][x] is effectively *(a + y*W + x), but for T **a, a[y] [x] is *(*(a + y) + x). Of course there is multiplication implicit in the pointer arithmetic...



On Nov 12, 2007, at 12:58 PM, Jason Horn wrote:

Dave,

Thanks for your input. Wouldn't something like array[x + y *width] be slower than array2d[x][y] when you are iterating over a large image? Does the extra multiplication operation slow you down?

- Jason

I am not concerned by the multiplication, but I don't claim to be an expert in things optimal...


dave

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: drawing an array of pixels to the screen
      • From: John Stiles <email@hidden>
References: 
 >drawing an array of pixels to the screen (From: Jason Horn <email@hidden>)
 >Re: drawing an array of pixels to the screen (From: John Stiles <email@hidden>)
 >Re: drawing an array of pixels to the screen (From: Jason Horn <email@hidden>)
 >Re: drawing an array of pixels to the screen (From: Jean-Daniel Dupas <email@hidden>)
 >Re: drawing an array of pixels to the screen (From: David Spooner <email@hidden>)
 >Re: drawing an array of pixels to the screen (From: Jason Horn <email@hidden>)
 >Re: drawing an array of pixels to the screen (From: John Stiles <email@hidden>)

  • Prev by Date: [Meeting] Toronto Area Cocoa and WebObjects Developer Group - November 13, 2007
  • Next by Date: Re: Change a NSMenu's shape?
  • Previous by thread: Re: drawing an array of pixels to the screen
  • Next by thread: Re: drawing an array of pixels to the screen
  • Index(es):
    • Date
    • Thread