Skip to main content

LAG_BIAS

Constant LAG_BIAS 

Source
pub const LAG_BIAS: i32 = 4;
Expand description

Bias added to lags so they fit an unsigned CTX_BITS-bit field.

Lags can be negative (preparation ops run before chain 0), but a hardware field is unsigned. The timetable stores lag + LAG_BIAS, and the decode step adds CTX_BIAS back in, so the bias cancels: period + BIAS − (lag + BIAS) = period − lag. A compile-time assertion below checks that every biased lag fits.