Little Endian Big Endian?

Mac OSX specific forum
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Little Endian Big Endian?

Post by Nik »

Ok Mac OS X is Big Endian and Windows is little Endian so what problems to fear when doing a Filetransfer system based on PBs Network libary communicating between Mac OS X and Windows? (All Apps in PB)
bye Nik
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Nothing, I think.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

I think the actual transfer won't mess with the byte sequence. So the issue, if anything, will be the "endian-ness" of the source data, as this will be retained and therefore either has to be fixed before or after transfer.

But I am guessing.
@}--`--,-- A rose by any other name ..
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

If you also have to send the length of the content i would have to make sure that for example both sides use little endain.
Right?
Fred
Administrator
Administrator
Posts: 16664
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Yes, it's true. I don't think it will work for now, i will fix that ASAP.
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

What do you mean it ins't working now? No function for conversion or no network support :wink:
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Code: Select all

Procedure LittleToBig(Long.l)
  PokeB(@LongBig+2,PeekB(@Long+3))
  PokeB(@LongBig+3,PeekB(@Long+2))
  PokeB(@LongBig,PeekB(@Long+1))
  PokeB(@LongBig+1,PeekB(@Long))
ProcedureReturn LongBig.l
EndProcedure
Is this correct?
I also noticed that 'UNIX' is not the same as PokeS(@Address,"UNIX") Why?
And thats te point that makes us think that it should be called XINU Problem instead of NUXI Problem *confused*
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

A little code used for a value from a file...

Code: Select all

nb.l=ReadLong()
MOV eax,nb
BSWAP eax
MOV nb,eax
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Well it musst be correct but

Code: Select all


nb.l=0
PokeS(@nb,"UNIX",4)
MOV eax,nb
BSWAP eax
MOV nb,eax 

Debug PeekS(@nb,4)
Debuges XINU and it's called the NUXI Problem so wtf
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

Sorry, I don't understand. :?
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Not 100% sure what we are getting at here, but ...

"UNIX" is 4 bytes long, respresenting here, I think, a 4 byte integer?

XINU is how a 4 byte (long) reversal would appear
NUXI is how 2x2 byte (words) reversal would appear.

Also, are you reversing all data sent one side to the other? I think (stress, think) you would only need to reverse words/longs where those were stored as words/longs in the original data.

So
>> [long]+"ABC"+[word]+[word]+[byte] - or - [1234]ABC[12][34][1]
would go across as
>> [gnol]+"ABC"+[drow]+[drow]+[byte] - or - [4321]ABC[21][43][1]


If you are sending "UNIX" and then, on fixing it on the other side, you are ending up with "XINU" then you don't need to be fixing it.

If you are ending up with "NUXI" (unfixed) on other side, need to be fixing word reversals.

If you are ending up with "XINU" (unfixed) on other side, need to be fixing long reversals.

But I am not really sure what it is that we are talking about. :D What exactly are we trying to address? What are you getting on the "other side"?
@}--`--,-- A rose by any other name ..
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

It was a theoretical Problem :lol: Haven't got a Mac yet but was interested in it and maybe it was good because it seems like it reminded fred at something :lol:
Well maybe I can get my Hands on a Mac then I will test this Theorey in practice. But nice to know how the made this NUXI problem up. Because who the hell would stroe a 4 byte String in 2 words :oops:
Thanks a lot for your efford
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

In theory, no. For more details:
http://en.wikipedia.org/wiki/Endian
Post Reply