Subset Bitmask Integer Decoder
Decode an exact bounded subset mask into ascending least-significant-bit indexes; masks with bits outside the explicit universe are rejected.
Description
Decode an exact bounded subset mask into ascending least-significant-bit indexes; masks with bits outside the explicit universe are rejected.
A subset bitmask uses bit j to indicate membership of index j. Decimal text preserves masks wider than a floating-point integer.
When to use this tool
Decode an exact bounded subset mask into ascending least-significant-bit indexes; masks with bits outside the explicit universe are rejected.
- Prepare the supplied mask, size fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter mask, size. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.indexes. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require size from 0 to 128 and a nonnegative mask below 2^size. Return ascending indexes whose corresponding least-significant-bit-based mask bits are set.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| mask | Exact decimal integer text; keep it quoted in JSON rather than converting through a floating-point number. | Optional leading + or - and 1 to 256 decimal digits; no whitespace |
| size | size. | Integer from 0 to 128 inclusive |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.indexes | The indexes list in the ordering and representation described above. |
{
"input": {
"mask": "9",
"size": 4
},
"output": {
"result": {
"indexes": [
0,
3
]
}
}
} Limitations and assumptions
- Index zero is the low bit, unlike left-to-right textual bitstrings. No values outside the declared universe are retained.
- All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
- JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.
Alternative or Complementary methods
Retain the universe size, subset size and ordering convention with a rank. Use rank/unrank pairs from the same convention and distinguish subset masks from lexicographic indexes.
References
Similar or alternative tools
- Subset Bitmask Integer Encoder
Encode a bounded unique index subset into an exact nonnegative integer bitmask, with index zero as the least significant bit.
- Mixed Radix Digit Decoder
Decode a zero-based exact integer index into mixed-radix digits most-significant lane first; out-of-range indexes do not wrap.