aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-bit-array.c
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/e-bit-array.c
parent08f78aa8ded1e68c259825f1097ea6a6c69263bb (diff)
downloadgsoc2013-evolution-279a7d4091950e26057fe36a6dcb4463c2bebb30.tar.gz
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/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