aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-03-31 19:38:21 +0800
committerChris Lahey <clahey@src.gnome.org>2001-03-31 19:38:21 +0800
commit279a7d4091950e26057fe36a6dcb4463c2bebb30 (patch)
treec29129adcb999df6b0acb087763185c6c6a303e3 /e-util
parent08f78aa8ded1e68c259825f1097ea6a6c69263bb (diff)
downloadgsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.tar
gsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.tar.gz
gsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.tar.bz2
gsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.tar.lz
gsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.tar.xz
gsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.tar.zst
gsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.zip
Added e_bit_array_cross_and and e_bit_array_cross_or.
2001-03-31 Christopher James Lahey <clahey@ximian.com> * gal/util/e-bit-array.c, gal/util/e-bit-array.h: Added e_bit_array_cross_and and e_bit_array_cross_or. svn path=/trunk/; revision=9069
Diffstat (limited to 'e-util')
-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 */