Forrest logo
back to the bitwise tool

bitwise:tldr:aada4

bitwise: Run using interactive mode.
$ bitwise
try on your machine

The term "bitwise" refers to a type of operation that operates on individual bits of a binary representation of numerical values. In computer programming, bitwise operations are commonly performed at the binary level, manipulating individual bits by using logic gates.

Bitwise operations include logical AND, logical OR, logical XOR, and logical NOT. These operations allow programmers to manipulate and extract specific bits from numbers efficiently.

Here's a brief explanation of each bitwise operation:

  1. Logical AND (&): Performs a bitwise "and" operation between two numbers. Each corresponding bit of the operands is combined using the following rule: if both bits are 1, the result is 1; otherwise, the result is 0.

  2. Logical OR (|): Performs a bitwise "or" operation between two numbers. Each corresponding bit of the operands is combined using the following rule: if either bit is 1, the result is 1; otherwise, the result is 0.

  3. Logical XOR (^): Performs a bitwise "exclusive or" operation between two numbers. Each corresponding bit of the operands is combined using the following rule: if exactly one bit is 1, the result is 1; otherwise, the result is 0.

  4. Logical NOT (~): Performs a bitwise "not" operation on a single number. Each bit of the number is inverted, meaning 0 becomes 1 and 1 becomes 0.

These bitwise operations can be used for various purposes, such as manipulating individual bits in binary values, implementing flags or toggle switches, or performing optimizations in certain algorithms, among others.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the bitwise tool