Re: EndianU32_NtoB

2009-10-30 Thread Kyle Sluder
On Fri, Oct 30, 2009 at 5:37 PM, Sean McBride wrote: > I guess 'platform-independent format' is code for big endian. Maybe? Maybe not. It's a platform-independent format: struct CFSwappedFloat32 { uint32_t v; }; That doesn't imply anything about the data actually contained therein. --Kyle

Re: EndianU32_NtoB

2009-10-30 Thread Sean McBride
On 10/30/09 5:20 PM, Kyle Sluder said: >On Fri, Oct 30, 2009 at 10:31 AM, Sean McBride >wrote: >> Ah yes, I forgot about those... But I've found them not useful in >> practice.  I don't get why for ints they have host<->big, host<->little, >> etc. for the floats they don't.  Instead they have tho

Re: EndianU32_NtoB

2009-10-30 Thread Kyle Sluder
On Fri, Oct 30, 2009 at 10:31 AM, Sean McBride wrote: > Ah yes, I forgot about those... But I've found them not useful in > practice.  I don't get why for ints they have host<->big, host<->little, > etc. for the floats they don't.  Instead they have those weird host<- >>swapped.  And though they t

Re: EndianU32_NtoB

2009-10-30 Thread Sean McBride
On 10/30/09 7:52 PM, Adam R. Maxwell said: >>> I don't get why for ints they have host<->big, host<->little, >>> etc. for the floats they don't. Instead they have those weird host<- >>> swapped. And though they take floats, they return structs. >> >> I think this is to avoid storing swapped

Re: EndianU32_NtoB

2009-10-30 Thread Adam R. Maxwell
On Oct 30, 2009, at 1:46 PM, Jens Alfke wrote: > On Oct 30, 2009, at 10:31 AM, Sean McBride wrote: > >> I don't get why for ints they have host<->big, host<->little, >> etc. for the floats they don't. Instead they have those weird host<- >>> >> swapped. And though they take floats, they return

Re: EndianU32_NtoB

2009-10-30 Thread gMail.com
Converter.part[1] = Converter.part[2]; Converter.part[2] = swap_char; return Converter.float_value; #endif } > Da: Sean McBride > Organizzazione: Rogue Research Inc. > Data: Fri, 30 Oct 2009 13:51:18 -0400 > A: "gMail.com" , > Cc: Jens Alfke > Ogge

Re: EndianU32_NtoB

2009-10-30 Thread Sean McBride
On 10/30/09 6:29 PM, gMail.com said: >Cool. Thanks. I did the following, either when I read from the disk and when >I write to the disk > >Read unsigned int in case of PPC > outValue[i] = EndianU32_NtoB(inValue[i]); > >Write unsigned int in case of PPC >outV

Re: EndianU32_NtoB

2009-10-30 Thread Jens Alfke
On Oct 30, 2009, at 10:31 AM, Sean McBride wrote: I don't get why for ints they have host<->big, host<->little, etc. for the floats they don't. Instead they have those weird host<- swapped. And though they take floats, they return structs. I think this is to avoid storing swapped floats i

Re: EndianU32_NtoB

2009-10-30 Thread Sean McBride
On 10/30/09 9:48 AM, Kyle Sluder said: >> For floats Apple provides no API, but you can use a union like this: > >See CFSwappedFloat64: http://developer.apple.com/mac/library/ >DOCUMENTATION/CoreFoundation/Conceptual/CFMemoryMgmt/Tasks/ >ByteSwapping.html#//apple_ref/doc/uid/20001155-CJBEHAAG Ah

Re: EndianU32_NtoB

2009-10-30 Thread gMail.com
Cool. Thanks. I did the following, either when I read from the disk and when I write to the disk Read unsigned int in case of PPC outValue[i] = EndianU32_NtoB(inValue[i]); Write unsigned int in case of PPC outValue[i] = EndianU32_BtoN(inValue[i]); Read float in case of PPC

Re: EndianU32_NtoB

2009-10-30 Thread Kyle Sluder
On Oct 30, 2009, at 9:35 AM, "Sean McBride" wrote: For floats Apple provides no API, but you can use a union like this: See CFSwappedFloat64: http://developer.apple.com/mac/library/DOCUMENTATION/CoreFoundation/Conceptual/CFMemoryMgmt/Tasks/ByteSwapping.html#//apple_ref/doc/uid/20001155-CJB

Re: EndianU32_NtoB

2009-10-30 Thread Sean McBride
On 10/30/09 4:56 PM, gMail.com said: >In the past I have successfully used EndianU32_NtoB to read a "long" on a >PPC machine. Now I need to read and write an array of "unsigned int" and an >array of "float". May you please tell me how to do? For floats A

Re: EndianU32_NtoB

2009-10-30 Thread Jens Alfke
On Oct 30, 2009, at 8:56 AM, gMail.com wrote: In the past I have successfully used EndianU32_NtoB to read a "long" on a PPC machine. Now I need to read and write an array of "unsigned int" and an array of "float". May you please tell me how to do? Just writ

EndianU32_NtoB

2009-10-30 Thread gMail.com
In the past I have successfully used EndianU32_NtoB to read a "long" on a PPC machine. Now I need to read and write an array of "unsigned int" and an array of "float". May you please tell me how to do? Thanks -- LL ___