Re: drawing an array of pixels to the screen
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