Bitwise NOR
NOR is an OR with the result inverted.
A bit of the result has the value 1 only when neither input has the value 1 at that position.
No language has a NOR operator, so the code writes ~(a | b).
Try bitwise NOR in the bit editor
The result of 12 NOR 10 in an 8-bit register. Edit the expression or select a bit to flip it.
7
6
5
4
3
2
1
0
-15
value · 8 bits · signed
- hex
- 0xF1
Read the bits as
The truth table of NOR
| A | B | A NOR B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Where bitwise NOR is used
A NOR gate builds every other gate, as a NAND gate does.
A NOR of two masks gives the bits that neither mask covers.
An early flash memory and an early logic family both carry the NOR name.
Bitwise NOR: points to note
- The result depends on the bit width, because the NOT part fills every bit above the operands.
- A NOR with 0 is the same as a NOT of the other operand.
- Beetwise marks the entry as signed, because the raw result of NOT is negative.
- A NOR is not a NAND. NAND gives 0 only for two bits with the value 1, and NOR gives 1 only for two bits with the value 0.
The full bit editor
The full editor holds many values, evaluates expressions across them, and reads live values from a serial port.
Open this value in the full editorQuestions about bitwise NOR
- What is 12 NOR 10?
- In 8 bits the result is 241. The OR gives 14, and the NOT of 14 gives 241 in 8 bits.
- How do I write NOR in C?
- Write ~(a | b), then mask the result to the width you need.
- What is the difference between NOR and XNOR?
- NOR gives 1 only for two bits with the value 0. XNOR gives 1 whenever the two bits agree.