You can make this branch free like this

    uint32_t i = (258 > in[idx].length) ? in[idx].length : 258;