Git Product home page Git Product logo

in-depth-bitwise's Introduction

In-depth-bitwise

About Bitwise Operators

Bitwise operators are the fundamental operators in computer programming that are useful for manipulating individual bits in binary representation. These operators are commonly used in low-level programming, embedded systems, and various other applications where precise control over the binary representation of data is necessary.

Here are the uses of each bitwise operator:-

  • AND (&) Operator:

    Performs AND operation on each pair of bits. It returns '1' if both bits are '1' or else returns '0' for the remaining condition.

    For e.g (A & B)

  • OR (|) Operator:

    Performs OR operation on each pair of bits. It returns '1' if one or both of them are '1' else returns '0'.

    For e.g (A | B)

  • XOR (^) Operator:

    Performs a bitwise XOR (exclusive OR) operation on each pair of corresponding bits in the operands. It returns 1 if the bits are different; otherwise, it returns 0. XOR is useful for toggling or flipping specific bits.

    For e.g (A ^ B)

  • Left Shift (<<) Operator:

    Shifts the bits of the left operand (a) to the left by n positions, padding with zeros on the right. This operation is equivalent to multiplying a by 2^n.

    For e.g (A << B)

  • Right Shift (>>) Operator:

    Shifts the bits of the left operand (a) to the right by n positions. The behavior depends on the type of shift (logical or arithmetic) and the sign of the original number. In the logical right shift, zeros are padded on the left, while in the arithmetic right shift, the sign bit is preserved (it's filled with the original sign bit).

    For e.g ( A >> B)

  • NOT ( ~ )Operator:

    Performs complement operation on each of the bit of the operand. It inverts '1s' to '0s' and '0s'to '1s'.

    For e.g ( ~A)

About The Repository

This repository contains all the bitwise operations except NOT (~) Operator. The source code shows the working of each operator with their elaborate arithmetic operation being done on the operands.

Copy the source code and run it on any IDE which supports C++.

Fork the repo to make any contribution.

in-depth-bitwise's People

Contributors

masterujjval avatar

Stargazers

Khushi Gupta avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.