Integer bits inspect
integer-bits-inspect · version 1.0.0 · Numbers & math · free, no key needed
Inspect or edit fixed-width integer bits and fields; returns set positions, popcount and decimal, hex and binary.
Use when you need to: integer bitfield decode flags bit positions hexadecimal · list which bits are set in integer · popcount integer flags.
Decide before calling
Read the versioned contract and the supported scope below. Reuse integer-bits-inspect@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use integer-bits-inspect@1.0.0 for integer bitfield decode flags bit positions hexadecimal. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- integer bitfield decode flags bit positions hexadecimal
- list which bits are set in integer
- popcount integer flags
- test set clear toggle one bit
- extract bit field by position and length
- insert bitfield into register
- inspect firmware register mask
Not supported
- named hardware register databases
- byte endian conversion
- bit streams wider than 128 bits
Behavior
- Bit position zero is the least-significant bit; set_bits is ascending. Integer grammar matches the family grammar exactly.
- Extract and insert use length consecutive bits beginning at position, and the field must fit inside width.
- Mutation operations preserve every bit except the selected bit or field.
Input
operation(one of "inspect", "test", "set", "clear", "toggle", "extract", "insert", required)value(string or integer, required)width(one of 8, 16, 32, 64, 128, required)signed(boolean, required)position(integer, optional): min 0; max 127length(integer, optional): min 1; max 128field_value(string or integer, optional)
Output
standard_version(string, required)width(integer, required)signed(boolean, required)decimal(string, required)hex(string, required)binary(string, required)set_bits(array of integer, required): max items 128popcount(integer, required): min 0; max 128bit_set(boolean, optional)field_decimal(string, optional)field_hex(string, optional)field_binary(string, optional)
Limits
- max input bytes: 256
- max output bytes: 1024
- max width bits: 128
- max set bits: 128
- max iterations: 128
Example
Request input:
{
"operation": "inspect",
"value": "0xa5",
"width": 8,
"signed": false
}
Response:
{
"result": {
"standard_version": "ISO/IEC 9899:2018 6.5.7, 6.5.10-6.5.12; ISO/IEC 14882:2020 [basic.fundamental]",
"width": 8,
"signed": false,
"decimal": "165",
"hex": "0xa5",
"binary": "0b10100101",
"set_bits": [
0,
2,
5,
7
],
"popcount": 4
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "integer-bits-inspect",
"version": "1.0.0",
"input": {
"operation": "inspect",
"value": "0xa5",
"width": 8,
"signed": false
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/integer-bits-inspect/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"operation":"inspect","value":"0xa5","width":8,"signed":false}'
The machine-readable contract is at /v1/tools/integer-bits-inspect/versions/1.0.0.
CLI
node cli.mjs run integer-bits-inspect 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Integer bitwise compute: Compute fixed-width integer AND, OR, XOR, NOT, AND-NOT, shifts or rotates; returns decimal, hex and binary.
- Integer expression evaluate: Evaluate exact integer arithmetic and return decimal, hexadecimal, and binary results.
- Integer expression parse: Parse an integer expression and return its tokens, required variables, precedence tree, and precedence table.
- Integer twos complement convert: Reinterpret one fixed-width two's-complement pattern as signed and unsigned; returns both decimals, hex and binary.
- Roman numeral convert: Convert integers 1–3999 to canonical Roman numerals and strictly parse canonical numerals back to integers.
- Array integer clamp: Clamp an array of canonical integer strings to optional inclusive min and max bounds.