aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/e-bit-array.c26
-rw-r--r--e-util/e-bit-array.h4
2 files changed, 29 insertions, 1 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
diff --git a/e-util/e-bit-array.h b/e-util/e-bit-array.h
index 5cb33b22b7..7469413be3 100644
--- a/e-util/e-bit-array.h
+++ b/e-util/e-bit-array.h
@@ -57,7 +57,6 @@ void e_bit_array_select_single_row (EBitArray *eba,
void e_bit_array_toggle_single_row (EBitArray *eba,
int row);
-/* Protected Functions */
void e_bit_array_insert (EBitArray *esm,
int row,
int count);
@@ -72,6 +71,9 @@ void e_bit_array_move_row (EBitArray *esm,
int new_row);
gint e_bit_array_bit_count (EBitArray *esm);
+gboolean e_bit_array_cross_and (EBitArray *esm);
+gboolean e_bit_array_cross_or (EBitArray *esm);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */