Byte order

Hello!
Looking on some source, i saw this:

#if SDL_BYTEORDER == SDL_BIG_ENDIAN

This BIG_ENDIAN has something to do with network / host byte order?
I knew that “Big Endian” word from Sockets… and just wanted to know what
this represents in SDL.

Thanks you :slight_smile:

                       Eduardo Garcia Rajo (h)------------------------------------------------------------------

Visite: http://www.solucion-digital.com.ar
SOLUCION DIGITAL
Redes - Software - Servicios

Hmm… may be im confused, but… tell me if im so.

Is it possible that :

#if SDL_BYTEORDER == SDL_BIG_ENDIAN

Will check if my PC Works with host byte order or network byte order, just
to create a surface for example, in the correct way?

I saw at the SDL Doc that the mask of an R, G, B, A will depend on the BYTE
ORDER of the machine…

Thanks again.

                       Eduardo Garcia Rajo (h)------------------------------------------------------------------

Visite: http://www.solucion-digital.com.ar
SOLUCION DIGITAL
Redes - Software - Servicios

Hi there,

You can use this if you write a app for Mac and for a PC. You will
need it there because both systems use diffrent byte order. For
example if you create a surface you will have to select where is the
red color, where the blue one and so one…

See the documentation about SDL_CreateSurfecae.

Bye Bye
Steffen.–

Steffen Pohle (@Steffen_Pohle)| _ x
http://stpohle.bei.t-online.de | /#/ BomberClone - The Clone of
JabberID: stpohle at amessage.de ||###| DynaBlaster and Bomberman
ICQ: 370965 Yahoo: stpohle | #/ http://www.bomberclone.de
MSN: stpohle at hotmail.com |

Endianness has to do with the processor (Intel, PowerPC, etc.), some
processors store the words (16, 32 or 64bit long depending on the
processor) starting from the lowest byte, and some processors store the
information starting from the highest byte.

therefore, when you create a surface, you have to know if the processor
stores the bytes starting from the lowest byte of starting from the
highest byte. For example:

We have a pointer “p”, and we make

*p=0x11223344

Now we create a byte pointer: char *p2=(char *)p

If the processor starting from the loest byte, p2[0]=0x44, but if the
processor stores the information starting from the highest byte, p2[0]=0x11.

This is called “endianness”, there are BIG_ENDIAN processors and
LOW_ENDIAN procesors. The information is needed to know where to place
the R,G,B and A channels inside the pixels of a surface.

I hope theexplanation is understandable!! :wink:

santi> Hello!

       Looking on some source, i saw this:


#if SDL_BYTEORDER == SDL_BIG_ENDIAN

This BIG_ENDIAN has something to do with network / host byte order?
I knew that “Big Endian” word from Sockets… and just wanted to
know what
this represents in SDL.

Thanks you :slight_smile:

                      Eduardo Garcia Rajo (h)

Visite: http://www.solucion-digital.com.ar
SOLUCION DIGITAL
Redes - Software - Servicios

Santi thanks a lot for ur reply!
I understand it perfectly now :slight_smile:

                       Eduardo Garcia Rajo (h)------------------------------------------------------------------

Visite: http://www.solucion-digital.com.ar
SOLUCION DIGITAL
Redes - Software - Servicios

----- Original Message -----
From: santi.ontanon@terra.es (Santi Ontanon)
To:
Sent: Tuesday, June 10, 2003 5:57 AM
Subject: Re: [SDL] BYTE ORDER

Endianness has to do with the processor (Intel, PowerPC, etc.), some
processors store the words (16, 32 or 64bit long depending on the
processor) starting from the lowest byte, and some processors store the
information starting from the highest byte.

therefore, when you create a surface, you have to know if the processor
stores the bytes starting from the lowest byte of starting from the
highest byte. For example:

We have a pointer “p”, and we make

*p=0x11223344

Now we create a byte pointer: char *p2=(char *)p

If the processor starting from the loest byte, p2[0]=0x44, but if the
processor stores the information starting from the highest byte,
p2[0]=0x11.

This is called “endianness”, there are BIG_ENDIAN processors and
LOW_ENDIAN procesors. The information is needed to know where to place
the R,G,B and A channels inside the pixels of a surface.

I hope theexplanation is understandable!! :wink:

santi

Hello!
Looking on some source, i saw this:

#if SDL_BYTEORDER == SDL_BIG_ENDIAN

This BIG_ENDIAN has something to do with network / host byte order?
I knew that “Big Endian” word from Sockets… and just wanted to
know what
this represents in SDL.

Thanks you :slight_smile:

                      Eduardo Garcia Rajo (h)

Visite: http://www.solucion-digital.com.ar
SOLUCION DIGITAL
Redes - Software - Servicios


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl