forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bitwise and hexadecimal :S
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Mon Apr 24, 2006 6:14 am    Post subject: bitwise and hexadecimal :S Reply with quote

hmm can anyone explain to me the bitwise operater?

eg: 0110 & 0011
0010

and can someone explain hexadecimal.. it scare's me 0-0

eg:

123 = 7 * 161 + B * 160 = 7B16

btw the 161.. the end 1 is a powerand the 0 on 160 and the 16 at the end :P
Back to top
View user's profile Send private message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Mon Apr 24, 2006 6:52 am    Post subject: Reply with quote

ok the and operator compares each bits of the two arguments and then returns 1 if both bits are the same or 0 if they are not. easily explained using a table

A B O
0 0 0
1 0 0
0 1 0
1 1 1

so for your example
0110
0011
only the 2nd from the left bits are the same so output is 0010

hex is simple
Decimal 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... 26 ... 32
Hex 1 2 3 4 5 6 7 8 9 A B C D E F 11 12 13 ... 1A ... 20
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Mon Apr 24, 2006 6:56 am    Post subject: Reply with quote

ok i got the hang of bitwise noew but the hex thingy lol how the hell does it make up 7B with a small 16?
Back to top
View user's profile Send private message
johnsto



Joined: 18 Jan 2006
Posts: 30

PostPosted: Mon Apr 24, 2006 7:55 am    Post subject: Reply with quote

Well, first, think of decimal.

10 is a 1 and a 0. It means add 1 ten and 0 ones...
(1 * ten) + (0 * one) = ten

24 is a 2 and a 4. It means add 2 tens and 4 ones...
(2 * 10) + (4 * 1) = twenty-four

321 is a 3, 2 and a 1. It means add 3 hundreds, 2 tens and 1 one...
(3 * 100) + (2 * 10) + (1 * 1) = three-hundred and twenty-one


Hexadecimal is just the same, but uses sixteen instead of ten. Because there are only 10 digits (0-9) we use A-E to represent values ten to fifteen.

10 is a 1 and a 0. It means add 1 sixteen and 0 ones...
(1 * sixteen) + (0 * one) = 16

24 is a 2 and a 4. It means add 2 sixteens and 4 ones...
(2 * 16) + (4 * 1) = 38

B0 is a B (11) and a 0. It means add 11 sixteens and 0 ones...
(11 * 16) + (0 * one) = 176

ABC is an A (10), a B (11) and a C (12). It means add 10 two-hundred and fifty-sixes, 11 sixteens and 12 ones...
(12 * 256) + (11 * 16) + (0 * 1) = 2748
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Mon Apr 24, 2006 2:47 pm    Post subject: Reply with quote

fix: 0-9 == zero thru nine
A-F == ten thru fifteen

zero (0) is a value so its sixteen values for HEX
0 1 2 3 4 5 6 7 8 9 A B C D E F

TIP: now figure my signature ;)
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Mon Apr 24, 2006 3:58 pm    Post subject: Reply with quote

Moved to offtopic, since this has nothing to do with PSP...
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Mon Apr 24, 2006 8:09 pm    Post subject: Reply with quote

all i get is

10011011
00101010
11010111
10001001
10111010

00010001
Back to top
View user's profile Send private message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Tue Apr 25, 2006 2:42 am    Post subject: Reply with quote

dude hex is so simple! instead of us counting from 1-15 in decimal we count 1-F so it goes like
Decimal 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... 26 ... 32
Hex----- 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 ... 1A ... 20

and when we get past F(15 in decimal) it changes to 10 we goe back to the start of the 0-F system just like when we get to 9 we carry the 1 over as our ten and then place the 0 for our units so 16 is 10 in hex 17 is 11, 25 is 19, 26 is 1A
google it if your still stuck
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Tue Apr 25, 2006 5:07 am    Post subject: Reply with quote

its hard to understand when ur only 13 ^_^

ok so what is 7b16 in just decimal?
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Tue Apr 25, 2006 9:12 am    Post subject: Reply with quote

It's like Hundreds, Tens and Units you did at school when you were little. Except today the tops of the columns aren't hundreds, tens, and ones, they're 256s, 16s and 1s. So take your 7B and put it under those columns.
Code:

256 16 1
  0  7 B

We've already said that A->F represent 10,11,12,13,14,15 so we have
B lots of 1 and 7 lots of 16
B*1 + 7*16
11 + 112
=123

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Tue Apr 25, 2006 9:58 am    Post subject: Reply with quote

The notation 7B16 just indicates that it's written in base 16. Typically in computer science we prefer to write "7Bh" or "0x7B" instead.
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Wed Apr 26, 2006 2:16 am    Post subject: Reply with quote

ok i think am getting the hang of it .. :D ty all expcally the ones with a really big post 0_0
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Wed Apr 26, 2006 1:46 pm    Post subject: Reply with quote

Paradox.psp wrote:
all i get is

10011011
00101010
11010111
10001001
10111010

00010001


incorrect
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Thu Apr 27, 2006 3:46 am    Post subject: Reply with quote

how about 00000000
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Thu Apr 27, 2006 4:27 am    Post subject: Reply with quote

Paradox.psp wrote:
how about 00000000


incorrect
hint: try binary ;)
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Thu Apr 27, 2006 4:31 am    Post subject: Reply with quote

binary? lol
Back to top
View user's profile Send private message
Orfax



Joined: 08 Apr 2004
Posts: 21
Location: Adelaide, Australia

PostPosted: Thu Apr 27, 2006 11:46 am    Post subject: Reply with quote

As they say, there are only 10 types of people in this world. Those that understand binary and those that don't. :)
_________________
Look deep into their eyes for what they have to say, Emotions take control of life everyday
Death (Nothing Is Everything)
Back to top
View user's profile Send private message Visit poster's website
Viper8896



Joined: 26 Jan 2006
Posts: 110

PostPosted: Thu Apr 27, 2006 6:34 pm    Post subject: Reply with quote

Orfax wrote:
As they say, there are only 10 types of people in this world. Those that understand binary and those that don't. :)
lol 10 types :)
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Fri Apr 28, 2006 12:44 am    Post subject: Reply with quote

what is it?
Back to top
View user's profile Send private message
Viper8896



Joined: 26 Jan 2006
Posts: 110

PostPosted: Fri Apr 28, 2006 12:10 pm    Post subject: Reply with quote

Paradox.psp wrote:
what is it?


10 binary not ten decimal

10 binary = 2 decimal
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Sat Apr 29, 2006 12:30 am    Post subject: Reply with quote

the answer! :D
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Sat Apr 29, 2006 1:30 am    Post subject: Reply with quote

Paradox.psp wrote:
the answer! :D

incorrect
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Sat Apr 29, 2006 1:54 am    Post subject: Reply with quote

telll me it!! ... how can u use binary? i need answer!
Back to top
View user's profile Send private message
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Tue May 02, 2006 1:05 am    Post subject: Reply with quote

Just something additional, think of the carries you do when you add one.

In decimal, if I have 9 and add 1 to it, it becomes 0 carry 1 (or 0d10, which is 2 base10 numbers)
In binary, if I have 1 and I add 1, it becomes 0 carry 1, or (0b10, which is 2 base2 numbers)
In hexidecimal, if I have F and add 1, I get 0 carry 1, (or 0x10, which is 2 base16 numbers)

To add to johnso's rundown, think of binary:
0b10 is a 1 and a 0. It means add 1 two and 0 ones...
(1 * 2) + (1 * 0) = two

0b11 is a 1 and a 1. It means add 1 two and 1 ones...
(1 * 2) + (1 * 1) = three

0b100 is a 1, a 0 and a 0. It means add 1 four, 0 two and 0 ones...
(1 * 4) + (0 * 2) + (0 * 1) = four

0b1000000
(1 * 64) + (0 * 32) + (0 * 16) + (0 * 8) + (0 * 4) + (0 * 2) + (0 * 1) = ?? you figure it out...

also one more statement that I dont know if you have in your current level math: powers of two. You should see that all the numbers in the last example I gave you can be made by multiples of two
1 = 2^0 (2 to the power of 0)
2 = 2^1 (2)
4 = 2^2 (2x2)
8 = 2^3 (2x2x2)
16= 2^4 (2x2x2x2)

and this works the same for the others, base2 (binary), base8 (octal), base10 (decimal), base16 (hexidecimal)
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Tue May 02, 2006 5:23 am    Post subject: Reply with quote

ok that was a big help.. i think i know but the way his question is layed out.. do i work them out and add them up?
Back to top
View user's profile Send private message
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Tue May 02, 2006 9:35 pm    Post subject: Reply with quote

It looks to me like an 5 letter word; if so you'd convert them to hex and either look them up on a ascii table or put them into a hex editor to see what it would spell. When looking at something in a hex editor, 8 bits (8 ones and zeros = 2 hexidecimal characters) represent one character (or byte), since there are no operands (*/+-|~) and its split into 5 bytes....
Back to top
View user's profile Send private message
Orfax



Joined: 08 Apr 2004
Posts: 21
Location: Adelaide, Australia

PostPosted: Wed May 03, 2006 8:05 am    Post subject: Reply with quote

cory1492 wrote:
It looks to me like an 5 letter word; if so you'd convert them to hex and either look them up on a ascii table...

It can't be ASCII, as the top bit is set for 4 of the bytes. ASCII is only 0 - 127 (0x0 to 0x7F in hex).
_________________
Look deep into their eyes for what they have to say, Emotions take control of life everyday
Death (Nothing Is Everything)
Back to top
View user's profile Send private message Visit poster's website
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Mon May 08, 2006 5:11 am    Post subject: Reply with quote

Gotcha, I think somewhere along the line I forgot that ASCII isnt only a subset of a larger whole... at any rate when I used the method with a hex editor I got gibberish/symbols.
Back to top
View user's profile Send private message
Paradox.psp



Joined: 06 Feb 2006
Posts: 27
Location: N.ireland LISBURN

PostPosted: Mon May 08, 2006 5:48 am    Post subject: Reply with quote

anwser plz :P
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Wed May 10, 2006 9:13 am    Post subject: Reply with quote

HINTS:
it is not ascii
it is not 5 letters
it is not hexadecimal
it is not binary

;)
thats all i give
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> General Discussion All times are GMT + 10 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group