aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-bit-array.c
diff options
context:
space:
mode:
Diffstat (limited to 'e-util/e-bit-array.c')
-rw-r--r--e-util/e-bit-array.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c
index ba65c53120..f8934f8b4e 100644
--- a/e-util/e-bit-array.c
+++ b/e-util/e-bit-array.c
@@ -294,6 +294,32 @@ e_bit_array_bit_count (EBitArray *eba)
return eba->bit_count;
}
+gboolean
+e_bit_array_cross_and (EBitArray *eba)
+{
+ int i;
+ for (i = 0; i < eba->bit_count / 32; i++) {
+ if (eba->data[i] != ONES)
+ return FALSE;
+ }
+ if ((eba->bit_count % 32) && ((eba->data[i] & BITMASK_LEFT(eba->bit_count)) != BITMASK_LEFT(eba->bit_count)))
+ return FALSE;
+ return TRUE;
+}
+
+gboolean
+e_bit_array_cross_or (EBitArray *eba)
+{
+ int i;
+ for (i = 0; i < eba->bit_count / 32; i++) {
+ if (eba->data[i] != 0)
+ return TRUE;
+ }
+ if ((eba->bit_count % 32) && ((eba->data[i] & BITMASK_LEFT(eba->bit_count)) != 0))
+ return TRUE;
+ return FALSE;
+}
+
#define OPERATE(object, i,mask,grow) ((grow) ? (((object)->data[(i)]) |= ((guint32) ~(mask))) : (((object)->data[(i)]) &= (mask)))
void