You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2010/02/08 20:16:48 UTC
svn commit: r907759 - in /lucene/lucy/trunk/core/Lucy: Object/BitVector.c
Util/NumberUtils.bp
Author: marvin
Date: Mon Feb 8 19:16:44 2010
New Revision: 907759
URL: http://svn.apache.org/viewvc?rev=907759&view=rev
Log:
Add NumUtil_u1clear().
Modified:
lucene/lucy/trunk/core/Lucy/Object/BitVector.c
lucene/lucy/trunk/core/Lucy/Util/NumberUtils.bp
Modified: lucene/lucy/trunk/core/Lucy/Object/BitVector.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/BitVector.c?rev=907759&r1=907758&r2=907759&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/BitVector.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/BitVector.c Mon Feb 8 19:16:44 2010
@@ -12,14 +12,6 @@
static void
S_do_or_or_xor(BitVector *self, const BitVector *other, int operation);
-/* 1 bit per byte. Use bitwise and to see if a bit is set.
- */
-
-/* Clear a bit. Caller must ensure that tick is within capacity.
- */
-#define CLEAR(self, tick) \
- self->bits[ (tick >> 3) ] &= ~(lucy_NumUtil_u1masks[tick & 0x7])
-
/* Number of 1 bits given a u8 value.
*/
static const u32_t BYTE_COUNTS[256] = {
@@ -137,7 +129,7 @@
{
if (tick >= self->cap)
return;
- CLEAR(self, tick);
+ NumUtil_u1clear(self->bits, tick);
}
void
Modified: lucene/lucy/trunk/core/Lucy/Util/NumberUtils.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Util/NumberUtils.bp?rev=907759&r1=907758&r2=907759&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Util/NumberUtils.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Util/NumberUtils.bp Mon Feb 8 19:16:44 2010
@@ -123,6 +123,12 @@
inert inline void
u1set(void *array, u32_t tick);
+ /** Interpret <code>array</code> as an array of bits; clear the bit at
+ * <code>tick</code>.
+ */
+ inert inline void
+ u1clear(void *array, u32_t tick);
+
/** Interpret <code>array</code> as an array of bits; flip the bit at
* <code>tick</code>.
*/
@@ -406,6 +412,15 @@
u8bits[byte_offset] |= mask;
}
+static CHY_INLINE void
+lucy_NumUtil_u1clear(void *array, chy_u32_t tick)
+{
+ chy_u8_t *const u8bits = (chy_u8_t*)array;
+ const chy_u32_t byte_offset = tick >> 3;
+ const chy_u8_t mask = lucy_NumUtil_u1masks[tick & 0x7];
+ u8bits[byte_offset] &= ~mask;
+}
+
static CHY_INLINE void
lucy_NumUtil_u1flip(void *array, chy_u32_t tick)
{