HI ALL!
I'm working on a routine to convert littel to big endian longwords and get some problem...
maybe I'm only a newbe guy...
To convert shorts was all really simple! I use a ror(or rol) and all works great
The poblem was when I try to convert longs...probably I miss some function but I cant reach to swap the position for bytes to convert from little to big...
Any idea here?
I know that i have to swap the bytes of a long(for ex: 1,2,3,4 to 4,3,2,1) but I cant found any function in hollywood to do that...
Thanks a LOT!!!!!!
littel to big endian question...
littel to big endian question...
Simone"Tuxedo"Monsignori, Perugia, ITALY.
Re: littel to big endian question...
Solved
Simply copied a C method since the bitwise opertors was the same in Hollywood too
ANd I've miss the bitwise operators of Hollywood since today...
So topic closed
Simply copied a C method since the bitwise opertors was the same in Hollywood too
ANd I've miss the bitwise operators of Hollywood since today...
So topic closed
Simone"Tuxedo"Monsignori, Perugia, ITALY.
Re: littel to big endian question...
Would be cool if you would share the solution you found in case someone else also gets in trouble on this topic.
Thanks!
Thanks!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
Re: littel to big endian question...
Well...
I find rather easly the code:
inline void endian_swap(unsigned short& x)
{
x = (x>>8) |
(x<<8);
}
inline void endian_swap(unsigned int& x)
{
x = (x>>24) |
((x<<8) & 0x00FF0000) |
((x>>8) & 0x0000FF00) |
(x<<24);
}
On the net...
Than sonce the logical commands was exactly the same in Hollywood too I simply adapted that to my code
Easy
The full link was here:
http://www.codeguru.com/forum/showthread.php?t=292902
Hope that was usefull to someone
I find rather easly the code:
inline void endian_swap(unsigned short& x)
{
x = (x>>8) |
(x<<8);
}
inline void endian_swap(unsigned int& x)
{
x = (x>>24) |
((x<<8) & 0x00FF0000) |
((x>>8) & 0x0000FF00) |
(x<<24);
}
On the net...
Than sonce the logical commands was exactly the same in Hollywood too I simply adapted that to my code
Easy
The full link was here:
http://www.codeguru.com/forum/showthread.php?t=292902
Hope that was usefull to someone
Simone"Tuxedo"Monsignori, Perugia, ITALY.