• 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: float[4][3] into NSValue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: float[4][3] into NSValue


  • Subject: Re: float[4][3] into NSValue
  • From: Lorenzo <email@hidden>
  • Date: Tue, 20 Nov 2007 21:14:21 +0100

Thank you Allen, it worked like a charm. And this is a great news.
I can now store a lot of data in a single line. I suppose this is
endian-safe. It will work on Intel ad PPC. Right?
I mean, I can write values on Intel and read values on PPC and viceversa,
right?

Best Regards
--
Lorenzo
email: email@hidden
>
> From: Allen Smith <email@hidden>
> Date: Tue, 20 Nov 2007 11:57:56 -0800
> To: Paul Sargent <email@hidden>
> Cc: Lorenzo <email@hidden>, email@hidden
> Subject: Re: float[4][3] into NSValue
>

>
> On Nov 20, 2007, at 11:37 AM, Paul Sargent wrote:
>
>>
>> On 20 Nov 2007, at 19:16, Lorenzo wrote:
>>
>>
>>> Can I store a float[4][3] into an NSValue object?
>>> Or can I store my own struct in an NSValue?
>>> If yes, how to do that?
>>> And how to get back the float[4][3] from the NSValue?
>>>
>>
>> No, NSValues are for single values, not arrays of them.
>
> Why do you say that? NSValue can store arbitrary structures, as long as they
> are of fixed length.
>
> float test[4][3] = {{1.0, 2.0, 3.0}};
> float result[4][3] = {0.0};
>
> NSValue *value = [NSValue value:test withObjCType:@encode(float[4][3])];
>
> [value getValue:result];
>
> NSLog(@"%f %f %f", result[0][0], result[0][1], result[0][3]);
>
>
>>> >>
> 2007-11-20 11:54:03.553 test[18824] 1.000000 2.000000 0.000000
>
>
> Allen
>


_______________________________________________

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: float[4][3] into NSValue
      • From: Nick Zitzmann <email@hidden>
References: 
 >Re: float[4][3] into NSValue (From: Allen Smith <email@hidden>)

  • Prev by Date: Re: Crash in System Preferences
  • Next by Date: Re: float[4][3] into NSValue
  • Previous by thread: Re: float[4][3] into NSValue
  • Next by thread: Re: float[4][3] into NSValue
  • Index(es):
    • Date
    • Thread