0Pricing
Assembly Language & x86 Low-Level Systems Programming · Aula

Instruções bit a bit e de deslocamento

Domine a manipulação de bits em x86: AND, OR, XOR, NOT e as instruções de deslocamento e rotação usadas para mascaramento, alternância de sinalizadores e multiplicação rápida.

Instruções bit a bit e de deslocamento é uma aula grátis de Assembly Language & x86 Low-Level Systems Programming no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Assembly Language & x86 Low-Level Systems Programming, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Assembly Language & x86 Low-Level Systems Programming inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Why Bit Operations?

Low-level code constantly manipulates individual bits: setting flags, packing fields, masking, and fast math. x86 provides dedicated bitwise and shift instructions.

AND for Masking

AND keeps only the bits set in both operands, the standard way to mask out unwanted bits.

and eax, 0x0F   ; keep low nibble

OR for Setting Bits

OR forces specific bits to 1 while leaving others unchanged.

or eax, 0x80    ; set bit 7

XOR for Toggling

XOR flips bits where the mask is 1. A famous idiom zeroes a register quickly:

xor eax, eax    ; eax = 0

NOT for Inversion

NOT flips every bit (ones complement).

not eax

Logical Shift Left (SHL)

SHL shifts bits left, filling with zeros. Each shift left multiplies an unsigned value by two.

shl eax, 1      ; eax = eax * 2

Logical Shift Right (SHR)

SHR shifts right with zero fill, dividing an unsigned value by powers of two.

shr eax, 2      ; unsigned eax / 4

Arithmetic Shift (SAR)

SAR shifts right but preserves the sign bit, so it divides signed values correctly.

sar eax, 1      ; signed eax / 2

Rotate Instructions

ROL and ROR rotate bits around, wrapping the bit that falls off back in on the other side, used in hashing and crypto.

rol eax, 4

Bit Test Instructions

BT copies a chosen bit into CF so you can test it, while BTS/BTR test and set/reset it.

bt eax, 3       ; CF = bit 3 of eax

Common Idioms

Handy patterns:

  • xor reg, reg to zero
  • shl/shr for power-of-two math
  • and reg, mask to extract fields

Quick Check

Test your understanding of bit operations.

Recap

You learned bitwise and shift instructions:

  • AND mask, OR set, XOR toggle, NOT invert
  • SHL/SHR for unsigned power-of-two math
  • SAR preserves sign for signed division
  • ROL/ROR rotate; BT tests a bit into CF

Perguntas Frequentes

A aula “Instruções bit a bit e de deslocamento” é grátis?

Sim — o texto completo de “Instruções bit a bit e de deslocamento” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Assembly Language & x86 Low-Level Systems Programming, atualize para CoddyKit PRO. O curso de Assembly Language & x86 Low-Level Systems Programming inclui 4 aulas no total.

O que vou aprender em “Instruções bit a bit e de deslocamento”?

Domine a manipulação de bits em x86: AND, OR, XOR, NOT e as instruções de deslocamento e rotação usadas para mascaramento, alternância de sinalizadores e multiplicação rápida. Você pratica Assembly Language & x86 Low-Level Systems Programming com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Assembly Language & x86 Low-Level Systems Programming?

Nenhuma experiência prévia é necessária. Assembly Language & x86 Low-Level Systems Programming no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Instruções bit a bit e de deslocamento”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Assembly Language & x86 Low-Level Systems Programming?

Sim. Cada aula de Assembly Language & x86 Low-Level Systems Programming inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Instruções de movimentação de dados (MOV, PUSH, POP)
  2. Operações aritméticas e lógicas
  3. Saltos condicionais e laços
  4. Instruções bit a bit e de deslocamento
← Voltar para Assembly Language & x86 Low-Level Systems Programming