Coder Social home page Coder Social logo

bitwise-masking's Introduction

Results of bit operations

AND

┌────────────────────────────┐
│Operation:     AND          │  
│Binary A:      0000_0000 = 0│  
│Binary B:      0000_0000 = 0│  
│Result:        0000_0000 = 0│  
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     AND          │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0000 = 0│
│Result:        0000_0000 = 0│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     AND          │
│Binary A:      0000_0000 = 0│
│Binary B:      0000_0001 = 1│
│Result:        0000_0000 = 0│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     AND          │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0001 = 1│
│Result:        0000_0001 = 1│
└────────────────────────────┘

OR

┌────────────────────────────┐
│Operation:     OR           │
│Binary A:      0000_0000 = 0│
│Binary B:      0000_0000 = 0│
│Result:        0000_0000 = 0│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     OR           │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0000 = 0│
│Result:        0000_0001 = 1│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     OR           │
│Binary A:      0000_0000 = 0│
│Binary B:      0000_0001 = 1│
│Result:        0000_0001 = 1│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     OR           │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0001 = 1│
│Result:        0000_0001 = 1│
└────────────────────────────┘

XOR

┌────────────────────────────┐
│Operation:     XOR          │
│Binary A:      0000_0000 = 0│
│Binary B:      0000_0000 = 0│
│Result:        0000_0000 = 0│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     XOR          │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0000 = 0│
│Result:        0000_0001 = 1│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     XOR          │
│Binary A:      0000_0000 = 0│
│Binary B:      0000_0001 = 1│
│Result:        0000_0001 = 1│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     XOR          │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0001 = 1│
│Result:        0000_0000 = 0│
└────────────────────────────┘

NOT

┌──────────────────────────────┐
│Operation:     NOT            │
│Binary A:      0000_0000 = 0  │
│Binary B:      0000_0000 = 0  │
│Result:        1111_1111 = 255│
└──────────────────────────────┘
┌──────────────────────────────┐
│Operation:     NOT            │
│Binary A:      0000_0001 = 1  │
│Binary B:      0000_0000 = 0  │
│Result:        1111_1110 = 254│
└──────────────────────────────┘

Left shift

┌────────────────────────────┐
│Operation:     LEFT SHIFT   │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0001 = 1│
│Result:        0000_0010 = 2│
└────────────────────────────┘
┌────────────────────────────┐
│Operation:     LEFT SHIFT   │
│Binary A:      0000_0001 = 1│
│Binary B:      0000_0010 = 2│
│Result:        0000_0100 = 4│
└────────────────────────────┘
┌─────────────────────────────┐
│Operation:     LEFT SHIFT    │
│Binary A:      0000_0001 = 1 │
│Binary B:      0000_0100 = 4 │
│Result:        0001_0000 = 16│
└─────────────────────────────┘

Right shift

┌─────────────────────────────┐
│Operation:     RIGHT SHIFT   │
│Binary A:      0001_0000 = 16│
│Binary B:      0000_0001 = 1 │
│Result:        0000_1000 = 8 │
└─────────────────────────────┘
┌─────────────────────────────┐
│Operation:     RIGHT SHIFT   │
│Binary A:      0001_0000 = 16│
│Binary B:      0000_0010 = 2 │
│Result:        0000_0100 = 4 │
└─────────────────────────────┘
┌─────────────────────────────┐
│Operation:     RIGHT SHIFT   │
│Binary A:      0001_0000 = 16│
│Binary B:      0000_0011 = 3 │
│Result:        0000_0010 = 2 │
└─────────────────────────────┘
┌─────────────────────────────┐
│Operation:     RIGHT SHIFT   │
│Binary A:      0001_0000 = 16│
│Binary B:      0000_0100 = 4 │
│Result:        0000_0001 = 1 │
└─────────────────────────────┘

bitwise-masking's People

Contributors

dukimy 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.