Page 2 of 2
Re: Simple Big Endian / Little Endian byte order swap function.
Posted: Mon May 24, 2021 9:24 am
by DoubleDutch
This needs to be updated for the new C compiler.
Re: Simple Big Endian / Little Endian byte order swap function.
Posted: Wed Mar 08, 2023 6:29 am
by jacdelad
The functions provided here are used in Thorsten1867's PurePDF module (
http://forums.purebasic.com/german/view ... 7f#p343706). Unfortunately this makes it impossible to use it with the new C compiler. Is there an update to this?
Re: Simple Big Endian / Little Endian byte order swap function.
Posted: Wed Mar 08, 2023 11:15 am
by HeX0R
You can also use something simple like that:
Code: Select all
Structure _SL_
b.a[4]
EndStructure
Procedure _SwapLong(*l._SL_)
Swap *l\b[0], *l\b[3]
Swap *l\b[1], *l\b[2]
EndProcedure
Procedure _SwapWord(*w._SL_)
Swap *w\b[0], *w\b[1]
EndProcedure
a = $10203040
_SwapLong(@a)
Debug Hex(a, #PB_Long)
Re: Simple Big Endian / Little Endian byte order swap function.
Posted: Wed Mar 08, 2023 1:20 pm
by mk-soft
Re: Simple Big Endian / Little Endian byte order swap function.
Posted: Wed Mar 08, 2023 1:27 pm
by jacdelad
Ah great, thanks both of you!
Re: Simple Big Endian / Little Endian byte order swap function.
Posted: Mon Feb 19, 2024 10:36 pm
by AZJIO
Rescator wrote: Thu Mar 24, 2005 8:30 am
if you need to convert to/from RGB,BGR
Code: Select all
c=$1199FF
Debug Hex(c)
c=((c & $00FF00) | ((c & $0000FF) << 16) | ((c & $FF0000) >> 16))
Debug Hex(c)