Raised This Month: $ Target: $400
 0% 

[SOLVE] Bits


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Process
Junior Member
Join Date: Jan 2015
Location: Banned
Old 01-01-2015 , 05:33   [SOLVE] Bits
Reply With Quote #1

Can someone explain what does this take as a value

( 1 << 4 ) | ( 1 << 5 )

and what is it !

Last edited by Process; 01-01-2015 at 10:07.
Process is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-01-2015 , 06:00   Re: Bits
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=139916
RateX is offline
Process
Junior Member
Join Date: Jan 2015
Location: Banned
Old 01-01-2015 , 06:21   Re: Bits
Reply With Quote #3

did i told you to give me a link of a TUT ? i've already read it but i didn't understand the last part
Process is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-01-2015 , 07:14   Re: Bits
Reply With Quote #4

"what does this take as a value" can you explain that better?
But all you need is to understand bit-wise operators to understand that bit of code.
klippy is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-01-2015 , 07:38   Re: Bits
Reply With Quote #5

( 1 << 4 ) | ( 1 << 5 ) will result with a binary value of 11 0000
if you use that (the bit shifting part) in your code as an integer, the decimal value will be used ( 48 )

Last edited by jimaway; 01-01-2015 at 07:38.
jimaway is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 01-01-2015 , 09:28   Re: Bits
Reply With Quote #6

Try this calculator

http://ostermiller.org/calc/calculator.html

let me explain little bit

1 << 4 = 2^4 = 16
1 << 5 = 2^5 = 32

as a 11 000

so 16 | 32 = 48

Last edited by Freezo Begin; 01-01-2015 at 09:45.
Freezo Begin is offline
Process
Junior Member
Join Date: Jan 2015
Location: Banned
Old 01-01-2015 , 10:07   Re: Bits
Reply With Quote #7

Thanks all , now i understand better .
Process is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode