[Include] Encode IP
#3

Quote:
Originally Posted by System64
Посмотреть сообщение
very nice, rep+

can you explain what this code do:

pawn Код:
val += acc << (s*8);
I just want to know, specially for what use is <<
This line takes accumulated value and adds it to the result. "<< (s*8)" shifts bits to the left by s bytes (byte=8 bits), depending which part of the ip address was read, so the first part of the address goes to the left-most end of the value.

PRO TIP: You can use these function so encode/decode colors as well EncodeIP(R, G, B, O) will return color value, where O is opacity ;)
Reply


Messages In This Thread
Encode IP - by mick88 - 04.03.2012, 14:42
Re: Encode IP - by System64 - 04.03.2012, 14:48
Re: Encode IP - by mick88 - 04.03.2012, 14:54
Re: Encode IP - by FireCat - 04.03.2012, 14:56
Re: Encode IP - by T0pAz - 04.03.2012, 14:57

Forum Jump:


Users browsing this thread: 1 Guest(s)