Bit operation
A bitwise operation transforms or combines integer values by applying logical, arithmetic, or shifting rules to corresponding binary bits.
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 bit 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 bit 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.
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 bit 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 bit operation →
Related concepts
- unsigned integerused by · An unsigned integer is an integer type or representation whose values are nonnegative, with its representable range determined by its bit width and applicable rules.
- integeruses · An integer is a whole-number value with no fractional part, including negative numbers, zero, and positive numbers.
- short-circuit evaluationcontrasts with · Short-circuit evaluation is an evaluation strategy that skips remaining operands or processing when the result is already determined.
- boolean operationincludes · A Boolean operation combines or transforms truth-valued inputs according to logical rules to produce a truth-valued result.
- set unionimplements · Set union is the operation that produces a set containing every element belonging to at least one of its operand sets.
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.





