operator
#1

Hello , i was taking a look at operators at wiki but i don't understand on the following code . Please explain this to me.
PHP Code:
stock BigEndian:operator=(b)
{
    return 
BigEndian:(((>>> 24) & 0x000000FF) | ((>>> 8) & 0x0000FF00) | ((<< 8) & 0x00FF0000) | ((<< 24) & 0xFF000000));// Specially this line.
}
 
main()
{
    new
        
BigEndian:7;
    
printf("%d"_:a);

Reply
#2

I guess it just reverses the bits.

Take "7" like in the example, the binary value would be 00000000 00000000 00000000 00000111.
Reversing it would make it 00000111 00000000 00000000 00000000.

Or a better example would be:
00001111 10101010 00110011 00000000 becomes 00000000 00110011 10101010 00001111.

I think that code does something like this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)