You are not logged in. Please login at www.codechef.com to post your questions!

×

bitwise operators

if(b&1)

do these operators work only for numbers less than 16 bits?

if no, then how it will perform these operations?

asked 01 Feb '14, 15:23

rudra_sarraf's gravatar image

3★rudra_sarraf
33621119
accept rate: 9%


No. AND operator works on integers as well.

How? The same way it used to do.

What is your query exactly?

If you want a comparison between arithmetic and bitwise operations in performance aspects, then I would say it hardly matters. Because ultimately, the compiler optimizes your code(operations) so irrespective of which way you used, you will hardly see any performance difference. See here for some good examples for what can be achieved.

link

answered 01 Feb '14, 16:04

bugkiller's gravatar image

3★bugkiller
8.7k194898
accept rate: 9%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×184
×19

question asked: 01 Feb '14, 15:23

question was seen: 3,028 times

last updated: 01 Feb '14, 16:04