Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualnife87

Posted 18 November 2012 - 08:19 AM

Wikipedias explanation is quite good:
http://en.wikipedia.org/wiki/Bitwise_operation#AND

A bitwise AND takes two binary representations of equal length and performs the logical AND operation on each pair of corresponding bits. The result in each position is 1 if the first bit is 1 and the second bit is 1; otherwise, the result is 0. In this, we perform the multiplication of two bits; i.e., 1 × 0 = 0 and 1 × 1 = 1


For instance, you have a = 100 (01100100) and b = 50 (00110010), and if you write c = a & b (100 & 50 == 32) the result is:
01100100 (100)
00110010 (50)
------------
00100000 (32)

Since the 6th column (from the right) is the only one with a 1 in both a and b.

EDIT: Way too slow, it seems :-)

#3nife87

Posted 18 November 2012 - 08:18 AM

Wikipedias explanation is quite good:
http://en.wikipedia.org/wiki/Bitwise_operation#AND

A bitwise AND takes two binary representations of equal length and performs the logical AND operation on each pair of corresponding bits. The result in each position is 1 if the first bit is 1 and the second bit is 1; otherwise, the result is 0. In this, we perform the multiplication of two bits; i.e., 1 × 0 = 0 and 1 × 1 = 1


For instance, you have a = 100 (01100100) and b = 50 (00110010), and if you write c = a & b (100 amp; 50 = 32) the result is:
01100100 (100)
00110010 (50)
------------
00100000 (32)

Since the 6th column (from the right) is the only one with a 1 in both a and b.

EDIT: Way too slow, it seems :-)

#2nife87

Posted 18 November 2012 - 08:17 AM

Wikipedias explanation is quite good:
http://en.wikipedia.org/wiki/Bitwise_operation#AND

A bitwise AND takes two binary representations of equal length and performs the logical AND operation on each pair of corresponding bits. The result in each position is 1 if the first bit is 1 and the second bit is 1; otherwise, the result is 0. In this, we perform the multiplication of two bits; i.e., 1 × 0 = 0 and 1 × 1 = 1


For instance, you have a = 100 (01100100) and b = 50 (00110010), and if you write c = a & b (100 & 50 = 32) the result is:
01100100 (100)
00110010 (50)
------------
00100000 (32)

Since the 6th column (from the right) is the only one with a 1 in both a and b.

EDIT: Way too slow, it seems :-)

#1nife87

Posted 18 November 2012 - 08:17 AM

Wikipedias explanation is quite good:
http://en.wikipedia.org/wiki/Bitwise_operation#AND

A bitwise AND takes two binary representations of equal length and performs the logical AND operation on each pair of corresponding bits. The result in each position is 1 if the first bit is 1 and the second bit is 1; otherwise, the result is 0. In this, we perform the multiplication of two bits; i.e., 1 × 0 = 0 and 1 × 1 = 1


For instance, you have a = 100 (01100100) and b = 50 (00110010), and if you write c = a & b (100 & 50 = 32) the result is:
01100100 (100)
00110010 (50)
------------
00100000 (32)

Since the 6th column (from the right) is the only one with a 1 in both a and b.

PARTNERS