Bitwise operation
A bitwise operation manipulates or combines the individual bits in the binary representations of its operands.
100 Java Mistakes and How to Avoid Them
The bitwise XOR operator computes a bit-by-bit exclusive disjunction of integer operands.
- How it is used
- Prevents subtle Java failures in masks, shifts, packed flags, byte assembly, and overflow-sensitive arithmetic.
- How deep it goes
- Works through precedence, shift-distance rules, result types, sign extension, literal widening, and concrete corrected expressions.
- Examples
- Uses a flag-mask update, least-significant-bit mask, long bit setter, two-byte reader, binary-search midpoint, and oddness check.
- What you can do after
- Apply bit masks, shifts, and explicit grouping while avoiding signed-byte, long-literal, and boundary-shift errors.
Read how 100 Java Mistakes and How to Avoid Them explains bitwise operation →
Modern C
A bitwise operator is a C operator that independently combines or transforms corresponding bits of integer operands.
- How it is used
- Represents compact sets of independent flags and tests or updates individual memberships.
- How deep it goes
- Explains per-bit effects, set analogies, operator distinctions, and signed representation hazards, but defers broader arithmetic treatment.
- Examples
- Uses corvid membership flags, binary and hexadecimal operator tables, and unsigned negation patterns.
- What you can do after
- Apply it via C operators to encode flag sets, add memberships, test bits, and distinguish unsigned behavior from signed overflow.
Clojure: The Essential Reference
A bitwise operator performs a logical or shifting operation directly on the binary representation of an integer.
- How it is used
- Uses binary operations for efficient arithmetic, bit masks, bit containers, and recurring low-level computations.
- How deep it goes
- Defines operator families, contracts, exceptions, binary examples, signed shifts, and a powerset technique without detailing hardware internals.
- Examples
- Demonstrates binary conversion, masking, bit testing, clearing, shifting signed values, and powerset generation.
- What you can do after
- Apply Clojure bitwise functions to combine, inspect, modify, shift, and encode integer bit patterns.
Read how Clojure: The Essential Reference explains bitwise operation →
Modern C, Third Edition
A bitwise operator is a C operator that computes independently on corresponding bits of integer operands.
- How it is used
- Represents set membership compactly and manipulates integer bits independently.
- How deep it goes
- Explains per-bit behavior, set correspondences, short-circuit differences, and C23 utilities, but not hardware implementation.
- Examples
- Uses corvid flock masks, binary and hexadecimal bit tables, and C23 <stdbit.h> function examples.
- What you can do after
- Apply it via C operators and <stdbit.h> functions to construct, update, test, and analyze bit sets.
Read how Modern C, Third Edition explains bitwise operation →
Go in Action, Second Edition
A bitwise operation computes a result by manipulating the individual binary bits of integer operands.
- How it is used
- Uses integer-only operators to manipulate individual bits and represent data as bit fields.
- How deep it goes
- Defines six operators and explains bit clear, then descends into signed-versus-unsigned shifting and integer-width choices.
- Examples
- Uses an operator table and contrasts signed and unsigned right shifts to illustrate practical bit manipulation choices.
- What you can do after
- Apply it via Go’s integer operators while choosing sized unsigned types for predictable bit manipulation.
Read how Go in Action, Second Edition explains bitwise operation →
Rust in Action: Systems programming concepts and techniques
A bitwise operation transforms or combines integer values by operating on their individual binary bits.
- How it is used
- Uses masks and shifts to decode packed CPU opcodes into instruction groups, register fields, and numeric values.
- How deep it goes
- Works through masks, shifts, hexadecimal fields, and assertions, while stopping short of broader bitwise-operation coverage.
- Examples
- Demonstrates extracting c, x, y, d, nnn, and kk from the CHIP-8 opcode 0x71E4.
- What you can do after
- Builds opcode-field extraction using Rust’s bitwise AND and right-shift operators.
Read how Rust in Action: Systems programming concepts and techniques explains bitwise operation →
Also covered in
What to know first
- floating-point arithmeticFloating-point arithmetic is numerical computation using finite-precision representations of real numbers, which can introduce rounding and range errors.
- integerAn integer is a whole-number mathematical value, including negative numbers, zero, and positive numbers, with no fractional part.
- operatorAn operator is a symbol, keyword, or language construct that specifies an operation on one or more operands.
Related concepts
- unsigned integerused by · An unsigned integer is an integer type or representation whose values are nonnegative.
- integeruses · An integer is a whole-number mathematical value, including negative numbers, zero, and positive numbers, with no fractional part.
- boolean operationincludes · A Boolean operation combines or transforms truth-valued inputs according to a logical rule to produce a logical result.
- short-circuit evaluationcontrasts with · Short-circuiting is early termination of a computation or processing sequence when a condition or result makes further steps unnecessary.
- operationkind of · An operation is an action or computation performed on or by a system, object, or service that may produce a result or change state.
Questions about bitwise operation
What is bitwise operation?
A bitwise operation manipulates or combines the individual bits in the binary representations of its operands.
Which Manning books explain bitwise operation?
100 Java Mistakes and How to Avoid Them, Modern C, Clojure: The Essential Reference, Modern C, Third Edition, Go in Action, Second Edition and Rust in Action: Systems programming concepts and techniques.
What should I know before learning bitwise operation?
Manning books that teach bitwise operation usually introduce floating-point arithmetic, integer, Java and operator first.
What is the difference between bitwise operation and short-circuit evaluation?
A bitwise operation manipulates or combines the individual bits in the binary representations of its operands. Short-circuiting is early termination of a computation or processing sequence when a condition or result makes further steps unnecessary.
What kinds of bitwise operation are there?
Kinds of bitwise operation include bitwise OR and boolean operation.
What is bitwise operation a kind of?
Bitwise operation is a kind of operation. An operation is an action or computation performed on or by a system, object, or service that may produce a result or change state.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.





