[Gambas-user] big-endian / little-endian conversion
Ru Vuott
vuott at ...325...
Sat Aug 3 20:12:19 CEST 2013
Hello Jussi,
thank you for your suggestion.
Bye
Vuott
--------------------------------------------
Sab 3/8/13, Jussi Lahtinen <jussi.lahtinen at ...626...> ha scritto:
Oggetto: Re: [Gambas-user] big-endian / little-endian conversion
A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
Cc: "Benoit" <gambas at ...1...>
Data: Sabato 3 agosto 2013, 19:23
Dim word As Short = &2301
Print Hex((Shr(word, 8) And &00FF) Or (Shl(word, 8) And
&FF00))
Or:
Print Hex((Shr(CShort(&2301), 8) And &00FF) Or
(Shl(CShort(&2301), 8) And
&FF00))
Jussi
On Sat, Aug 3, 2013 at 7:14 PM, Ru Vuott <vuott at ...325...>
wrote:
> Hello,
>
> I was trying a big-endian / little-endian conversion.
>
> In web I found this C function:
>
> ((word>>8) & 0x00FF) |
((word<<8) & 0xFF00)
>
> word is a " 16bit " value.
>
>
> Well,
>
> I translated that function in Gambas:
>
> Print Hex((Shr(&2301, 8)
And &00FF) Or (Shl(&2301, 8) And &FF00))
>
> I was waiting for this value: 01 23
>
> but I do not understand why I obtain this
results: 23 01 23
>
>
> Where do I make the mistake ?
>
> Thanks
>
> vuott
>
>
>
------------------------------------------------------------------------------
> Get your SQL database under version control now!
> Version control is standard for application code, but
databases havent
> caught up. So what steps can you take to put your SQL
databases under
> version control? Why should you start doing it? Read
more to find out.
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but
databases havent
caught up. So what steps can you take to put your SQL
databases under
version control? Why should you start doing it? Read more to
find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list