Log inGet started
Package

bitmask_bits.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

bitmask_bits

The validator behind Field.bitmask(bits, default, mode). A component field declaring a bit mask carries a bitmask constraint, and the engine calls this on the field's default and on every write to it.

A value passes when it is a whole number in 0 .. 2^bits - 1. nil passes, so a mask field may be left unset.

Each rejection names the width and what about the value is not a mask of it — a fraction names no set of bits, a negative number is below the empty mask, and a value past 2^bits - 1 addresses bits the consumer does not have. Without the check a field declared as a u32 on the engine side accepts -1, 2.5 and 1e12 and reads each of them back unchanged, so the read-back is no evidence the value took.