static pmc_value_t
iaf_perfctr_value_to_reload_count(pmc_value_t v)
{
v &= (1ULL << core_iaf_width) - 1;
/* Sign extend the value and then invert it. */
return (1ULL << core_iaf_width) - v;
return -(int64_t)v << (64 - core_iaf_width) >> (64 - core_iaf_width);
}