Thread (3 messages) flat view 3 messages, 3 authors, 2011-06-27

Re: [PATCH] gianfar v5: implement nfc

From: Joe Perches <joe@perches.com>
Date: 2011-06-22 16:48:01

On Wed, 2011-06-22 at 11:29 +0200, Sebastian Pöhn wrote:
First of all thanks for the feedback. I know the fgar_swap_*bits
function is a bit ugly. The problem with your suggestion is that it is
necessary to swap a1<>a2 and b1<>b2 AT THE SAME TIME.
These swaps are done sequentially.
Otherwise
information the second swap is needing is swapped away by the first one.
How so?
quoted
swap_bits(temp_table->fe[new_first],
 temp_table->fe[old_first], 0xff80);
swap_bits(temp_table->fe[new_last],
 temp_table->fe[old_last], 0xff80);
new_first and old_first are swapped.
new_last and old_last are swapped.
quoted hunk ↗ jump to hunk
@@ -1356,10 +1356,13 @@ static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table,
 			new_first = mask_table[start].start + 1;
 			new_last = mask_table[i - 1].end;
I'm a bit confused by this:

+		if (prev != mask_table[i].block) {
+			old_first = mask_table[start].start + 1;
+			old_last = mask_table[i - 1].end;

[no changes to start or i]

+			new_first = mask_table[start].start + 1;
+			new_last = mask_table[i - 1].end;
+
+			gfar_swap_ff80_bits(&temp_table->fe[new_first],
+					&temp_table->fe[old_first],
+					&temp_table->fe[new_last],
+					&temp_table->fe[old_last]);

Doesn't this just swap the same bits around twice?

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help