Re: [PATCH 9/9] Remove unnecessary copies of variables in read/write_pieced_value

Simon Marchi
2017-04-14T15:21:38Z

On 2017-04-07 13:38, Andreas Arnez wrote:
> In read_pieced_value's main loop, the variables `dest_offset_bits' and
> `source_offset_bits' are basically just copies of `offset' and
> `bits_to_skip', respectively. In write_pieced_value the copies are
> reversed. This is not very helpful when trying to keep the logic
> between
> these functions in sync. Since the copies are unnecessary, this patch
> just removes them.

I agree about dest_offset_bits being the same as offset in
read_pieced_value and source_offset_bits being the same as offset in
write_pieced_value, I had also identified this as a potential
simplification. But I'd keep the names
source_offset_bits/dest_offset_bits rather than offset. Or maybe
offset_in_value_bits, something like that.

Also, it might be clearer if bits_to_skip was named source_bits_to_skip
in read_pieced_value and dest_bits_to_skip in write_pieced_value, to
clarify what is skipped exactly.

Thanks,

Simon