gcc complains about comparing a signed loop induction variable with an unsigned limit, or comparing an expected value and measured value. Fix by using unsigned throughout, except in one case where the signed value was needed for the data_value constructor.