tests: Fix a couple of compile warnings
This commit is contained in:
27
src/bitset.h
27
src/bitset.h
@@ -46,7 +46,7 @@ static inline void bit_clear_range(char* b, int from, int len) {
|
|||||||
for (; len > 0; len--) { bit_clear(b, from++); }
|
for (; len > 0; len--) { bit_clear(b, from++); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Counts the number of contiguous bits in array ''b'', starting at ''from''
|
/** Counts the number of contiguous bits in array ''b'', starting at ''from''
|
||||||
* up to a maximum number of bits ''len''. Returns the number of contiguous
|
* up to a maximum number of bits ''len''. Returns the number of contiguous
|
||||||
* bits that are the same as the first one specified.
|
* bits that are the same as the first one specified.
|
||||||
*/
|
*/
|
||||||
@@ -58,7 +58,8 @@ static inline int bit_run_count(char* b, int from, int len) {
|
|||||||
;
|
;
|
||||||
|
|
||||||
/* FIXME: debug this later */
|
/* FIXME: debug this later */
|
||||||
/*for (; (from+count) % 64 != 0 && len > 0; len--)
|
/*
|
||||||
|
for (; (from+count) % 64 != 0 && len > 0; len--)
|
||||||
if (bit_has_value(b, from+count, first_value))
|
if (bit_has_value(b, from+count, first_value))
|
||||||
count++;
|
count++;
|
||||||
else
|
else
|
||||||
@@ -71,12 +72,12 @@ static inline int bit_run_count(char* b, int from, int len) {
|
|||||||
}
|
}
|
||||||
for (; len > 0; len--)
|
for (; len > 0; len--)
|
||||||
if (bit_is_set(b, from+count))
|
if (bit_is_set(b, from+count))
|
||||||
count++;*/
|
count++;
|
||||||
|
*/
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An application of a bitset - a bitset mapping represents a file of ''size''
|
/** An application of a bitset - a bitset mapping represents a file of ''size''
|
||||||
* broken down into ''resolution''-sized chunks. The bit set is assumed to
|
* broken down into ''resolution''-sized chunks. The bit set is assumed to
|
||||||
* represent one bit per chunk. We also bundle a lock so that the set can be
|
* represent one bit per chunk. We also bundle a lock so that the set can be
|
||||||
* written reliably by multiple threads.
|
* written reliably by multiple threads.
|
||||||
@@ -92,7 +93,7 @@ struct bitset_mapping {
|
|||||||
* given resolution.
|
* given resolution.
|
||||||
*/
|
*/
|
||||||
static inline struct bitset_mapping* bitset_alloc(
|
static inline struct bitset_mapping* bitset_alloc(
|
||||||
uint64_t size,
|
uint64_t size,
|
||||||
int resolution
|
int resolution
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -123,8 +124,8 @@ static inline struct bitset_mapping* bitset_alloc(
|
|||||||
* file.
|
* file.
|
||||||
*/
|
*/
|
||||||
static inline void bitset_set_range(
|
static inline void bitset_set_range(
|
||||||
struct bitset_mapping* set,
|
struct bitset_mapping* set,
|
||||||
uint64_t from,
|
uint64_t from,
|
||||||
uint64_t len)
|
uint64_t len)
|
||||||
{
|
{
|
||||||
INT_FIRST_AND_LAST;
|
INT_FIRST_AND_LAST;
|
||||||
@@ -144,12 +145,12 @@ static inline void bitset_set(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Clear the bits in a bitset which correspond to the given bytes in the
|
/** Clear the bits in a bitset which correspond to the given bytes in the
|
||||||
* larger file.
|
* larger file.
|
||||||
*/
|
*/
|
||||||
static inline void bitset_clear_range(
|
static inline void bitset_clear_range(
|
||||||
struct bitset_mapping* set,
|
struct bitset_mapping* set,
|
||||||
uint64_t from,
|
uint64_t from,
|
||||||
uint64_t len)
|
uint64_t len)
|
||||||
{
|
{
|
||||||
INT_FIRST_AND_LAST;
|
INT_FIRST_AND_LAST;
|
||||||
@@ -172,8 +173,8 @@ static inline void bitset_clear(
|
|||||||
* the bit field.
|
* the bit field.
|
||||||
*/
|
*/
|
||||||
static inline int bitset_run_count(
|
static inline int bitset_run_count(
|
||||||
struct bitset_mapping* set,
|
struct bitset_mapping* set,
|
||||||
uint64_t from,
|
uint64_t from,
|
||||||
uint64_t len)
|
uint64_t len)
|
||||||
{
|
{
|
||||||
/* now fix in case len goes past the end of the memory we have
|
/* now fix in case len goes past the end of the memory we have
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
#define assert_bitset_is( map, val ) { \
|
#define assert_bitset_is( map, val ) {\
|
||||||
uint64_t *num = map->bits; \
|
uint64_t *num = (uint64_t*) map->bits; \
|
||||||
ck_assert_int_eq( val, *num ); \
|
ck_assert_int_eq( val, *num ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ START_TEST( test_bitset_run_count )
|
|||||||
struct bitset_mapping* map = bitset_alloc( 64, 1 );
|
struct bitset_mapping* map = bitset_alloc( 64, 1 );
|
||||||
uint64_t run;
|
uint64_t run;
|
||||||
|
|
||||||
assert_bitset_is( map, 0x0000000000000000 );
|
assert_bitset_is( map, 0x0000000000000000 );
|
||||||
|
|
||||||
bitset_set_range( map, 0, 32 );
|
bitset_set_range( map, 0, 32 );
|
||||||
assert_bitset_is( map, 0x00000000ffffffff );
|
assert_bitset_is( map, 0x00000000ffffffff );
|
||||||
|
Reference in New Issue
Block a user