[Asterisk-Users] Hosted PBX (vPBX) and Call/PickUP Groups

Matt Riddell matt.riddell at sineapps.com
Sun Sep 11 19:22:44 MST 2005


Chee Foong wrote:
> i guess may be it's a 64bit variable. so you can only use 0-63.

LOL!!!!

Bits work like this

[128][64][32][16][8][4][2][1]

So, you have a whole lot of bits, each one moving from right to left inceases
a power of 2.  Say you wanted to represent 10, then you would turn on the 8
and the 2 (8+2=10) so the binary representation (for an 8 bit variable) would be:

00001010

So, from that you can see that you could get from 0-255 in 8 bits.

If however you wanted the number to be able to go negative as well then you
would use one of the bits to determine the sign (i.e. +/-)

That would give you possible values between -127 and +127.

So, a max value of 63 would either indicate a signed 7 bit variable (dunno
where the other one went) or an unsigned 6 bit variable.

-- 
Cheers,

Matt Riddell
_______________________________________________

http://www.sineapps.com/news.php (Daily Asterisk News - html)
http://www.sineapps.com/rssfeed.php (Daily Asterisk News - rss)



More information about the asterisk-users mailing list