Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a3fe4b931bd0cf66

Jump to content

// Workers AI · dad joke modeWhat did bit inversion say to its friend? "You're always flipping out.

From Wikipedia, the free encyclopedia

In computing and telecommunications, bit inversion refers to the changing of the state of a bit or binary number to the opposite state, for example changing a 0 bit to 1 or vice versa.[1][2][3] It is often represented with a tilde (~).[4] It also refers to the changing of a state representing a given bit to the opposite state.

Usage in computing

[edit]

Many popular programming languages implement bit inversion as an operation. For example, in JavaScript, bit inversion is known as a 'bitwise NOT' and is implemented as seen below:

var a = 2;
var b = ~ a;

In this example, a is a 32-bit signed integer and in binary would be 00000000000000000000000000000010. Variable b is the bit inversion of variable a and equals 11111111111111111111111111111101 (−3 in decimal).

In Python:

>>> a = 2
>>> b = ~ a
>>> b
-3

References

[edit]
  1. "Bitwise NOT (~) - JavaScript | MDN". developer.mozilla.org. 2023-08-15. Retrieved 2023-10-17.
  2. "%BITNOT (Invert Bits)". www.ibm.com. 2023-04-11. Retrieved 2023-10-17.
  3. "Invert actual bits of a number". GeeksforGeeks. 2018-05-18. Retrieved 2023-10-17.
  4. "~ - Arduino Reference". www.arduino.cc. Retrieved 2023-10-17.

See also

[edit]