Bitwise Operations

// Samuel Burbano
const socials = {
  twitter: "@iosamuel",
  facebook: "iosamuel.dev",
  github: "iosamuel",
  youtube: "iosamuel",
  web: "iosamuel.dev"
};

Bits

Bits

0

1

Bits

0

1

1

0

1

Bits

0

1

1

0

1

0

0

1

0

1

Bits

0

1

1

0

1

0

0

1

0

1

Bits

Bits

Bitwise Operators

&

|

^

~

>>

<<

AND

OR

XOR (Exclusive OR)

NOT

Right Shift

Left Shift

Bitwise Operators

&

|

^

~

>>

<<

AND

Bit #1 Bit #2 Resultado
0 0 0
0 1 0
1 0 0
1 1 1

Bitwise Operators

AND

Bit #1 Bit #2 Resultado
0 0 0
0 1 0
1 0 0
1 1 1
0 0 1 0 0 1 0 1
0 0 0 1 0 1 1 1
0 0 0 0 0 1 0 1
37
23
= 5

37 & 23

&

|

^

~

>>

<<

Bitwise Operators

AND

any & 1 = impar

0 0 1 0 0 1 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
37
1
1
0 0 0 1 1 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0
24
1
0

&

|

^

~

>>

<<

Bitwise Operators

AND

any & 1 = impar

&

|

^

~

>>

<<

Bitwise Operators

&

|

^

~

>>

<<

OR

Bit #1 Bit #2 Resultado
0 0 0
0 1 1
1 0 1
1 1 1

Bitwise Operators

OR

Bit #1 Bit #2 Resultado
0 0 0
0 1 1
1 0 1
1 1 1
0 0 1 0 0 1 0 1
0 0 0 1 0 1 1 1
0 0 1 1 0 1 1 1
37
23
= 55

37 | 23

&

|

^

~

>>

<<

0

1

1

0

1

0

0

1

0

1

Bits

Bitwise Operators

OR

CANCEL OK NO YES HEADER
16 8 4 2 1
0 0 0 0 0

&

|

^

~

>>

<<

Bitwise Operators

OR

HEADER YES NO OK CANCEL
16 8 4 2 1
0 0 0 1 0
CANCEL OK NO YES HEADER
16 8 4 2 1

&

|

^

~

>>

<<

Bitwise Operators

OR

HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 0 1 0
CANCEL OK NO YES HEADER
16 8 4 2 1

&

|

^

~

>>

<<

Bitwise Operators

OR

HEADER YES NO OK CANCEL
16 8 4 2 1
1 1 1 1 1
CANCEL OK NO YES HEADER
16 8 4 2 1

&

|

^

~

>>

<<

Bitwise Operators

OR

HEADER YES NO OK CANCEL
16 8 4 2 1
1 0 0 1 0
CANCEL OK NO YES HEADER
16 8 4 2 1

&

|

^

~

>>

<<

Bitwise Operators

OR

HEADER YES NO OK CANCEL
16 8 4 2 1
1 0 0 1 0
CANCEL OK NO YES HEADER
16 8 4 2 1

&

|

^

~

>>

<<

0 0 0 1 0
1 0 0 0 0

1
 

0

0

1

0
YES
CANCEL
=
(YES, CANCEL)

YES | CANCEL

Bitwise Operators

&

|

^

~

>>

<<

AND y OR

HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 0 0 1
CANCEL OK NO YES HEADER
16 8 4 2 1

Bitwise Operators

AND y OR

HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 0 0 1
0 1 0 0 0

& OK

CANCEL OK NO YES HEADER
16 8 4 2 1

MODAL

=

0 1 0 0 0

&

|

^

~

>>

<<

Bitwise Operators

AND y OR

HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 0 0 1
0 0 0 1 0

& YES

CANCEL OK NO YES HEADER
16 8 4 2 1

MODAL

=

0 0 0 0 0

&

|

^

~

>>

<<

Bitwise Operators

AND y OR

&

|

^

~

>>

<<

Bitwise Operators

AND y OR

&

|

^

~

>>

<<

Bitwise Operators

XOR (Exclusive OR)

&

|

^

~

>>

<<

Bit #1 Bit #2 Resultado
0 0 0
0 1 1
1 0 1
1 1 0

Bitwise Operators

XOR (Exclusive OR)

&

|

^

~

>>

<<

HEADER YES NO OK CANCEL
16 8 4 2 1
1 1 1 1 1
CANCEL OK NO YES HEADER
16 8 4 2 1

Bitwise Operators

XOR (Exclusive OR)

&

|

^

~

>>

<<

HEADER YES NO OK CANCEL
16 8 4 2 1
1 1 1 1 1
CANCEL OK NO YES HEADER
16 8 4 2 1
1 0 0 0 0

^ CANCEL

=

0 1 1 1 1

Bitwise Operators

XOR (Exclusive OR)

&

|

^

~

>>

<<

HEADER YES NO OK CANCEL
16 8 4 2 1
1 1 1 1 1
CANCEL OK NO YES HEADER
16 8 4 2 1

^ CANCEL

HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 1 1 1
CANCEL OK NO YES HEADER
16 8 4 2 1

Bitwise Operators

XOR (Exclusive OR)

&

|

^

~

>>

<<

^ YES

HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 1 0 1
CANCEL OK NO YES HEADER
16 8 4 2 1
HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 1 1 1
CANCEL OK NO YES HEADER
16 8 4 2 1

Bitwise Operators

XOR (Exclusive OR)

&

|

^

~

>>

<<

^ YES

HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 1 0 1
CANCEL OK NO YES HEADER
16 8 4 2 1
HEADER YES NO OK CANCEL
16 8 4 2 1
0 1 1 1 1
CANCEL OK NO YES HEADER
16 8 4 2 1

Bitwise Operators

AND, OR y XOR

&

|

^

~

>>

<<

Bitwise Operators

AND, OR y XOR

&

|

^

~

>>

<<

Bitwise Operators

AND, OR y XOR

&

|

^

~

>>

<<

Bitwise Operators

AND, OR y XOR

&

|

^

~

>>

<<

¡RETO!

Agregar opciones de fuente:

Bold, Itálica, Subrayado

Bitwise Operations

// Samuel Burbano
const socials = {
  twitter: "@iosamuel",
  facebook: "iosamuel.dev",
  github: "iosamuel",
  youtube: "iosamuel",
  web: "iosamuel.dev"
};

¡GRACIAS!

Bitwise Operations

By Samuel Burbano

Bitwise Operations

Aprendamos que son las Bitwise Operations y como usarlas de manera práctica.

  • 443