summaryrefslogtreecommitdiff
path: root/gtk/gtkallocatedbitmask.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-09-10 18:46:58 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-09-12 11:24:37 -0400
commit0957ba522008bc08631ee209b4dae8d7c5a7dce0 (patch)
tree9c1a89a676beacc6dbff22b766bc88814f50cc9c /gtk/gtkallocatedbitmask.c
parent3a503b7ba18b52d990c547c7980607ba65957753 (diff)
downloadgtk+-0957ba522008bc08631ee209b4dae8d7c5a7dce0.tar.gz
bitmask: Optimize intersect
The functions was written in a way that would possibly resize the mask twice, which is not necessary.
Diffstat (limited to 'gtk/gtkallocatedbitmask.c')
-rw-r--r--gtk/gtkallocatedbitmask.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/gtkallocatedbitmask.c b/gtk/gtkallocatedbitmask.c
index 6f0f1f8616..567b86cb91 100644
--- a/gtk/gtkallocatedbitmask.c
+++ b/gtk/gtkallocatedbitmask.c
@@ -174,11 +174,14 @@ _gtk_allocated_bitmask_intersect (GtkBitmask *mask,
mask = gtk_bitmask_ensure_allocated (mask);
ENSURE_ALLOCATED (other, other_allocated);
- mask = gtk_allocated_bitmask_resize (mask, MIN (mask->len, other->len));
- for (i = 0; i < mask->len; i++)
+ for (i = 0; i < MIN (mask->len, other->len); i++)
{
mask->data[i] &= other->data[i];
}
+ for (; i < mask->len; i++)
+ {
+ mask->data[i] = 0;
+ }
return gtk_allocated_bitmask_shrink (mask);
}