Interface: tos.lib.Deluge.BitVecUtils
interface BitVecUtils
Provides generic methods for manipulating bit vectors.
- Author:
-
Jonathan Hui <jwhui@cs.berkeley.edu>
Commands
command result_t countOnes(uint16_t *pResult, uint8_t *bitVec, uint16_t length)
command result_t indexOf(uint16_t *pResult, uint16_t fromIndex, uint8_t *bitVec, uint16_t length)
command void printBitVec(char *buf, uint8_t *bitVec, uint16_t length)
Commands - Details
countOnes
command result_t countOnes(uint16_t *pResult, uint8_t *bitVec, uint16_t length)
- Parameters:
-
result
- the number of '1' bits
-
bitVec
- the bit vector
-
length
- the length of the bit vector in bits
- Returns:
-
SUCCESS
if the operation completed successfully;
FAIL
otherwise.
indexOf
command result_t indexOf(uint16_t *pResult, uint16_t fromIndex, uint8_t *bitVec, uint16_t length)
- Parameters:
-
result
- the location of the '1' bit
-
fromIndex
- the index to start search for '1' bit
-
bitVec
- the bit vector
-
length
- the length of the bit vector in bits
- Returns:
-
SUCCESS
if a '1' bit was found;
FAIL
otherwise.
printBitVec
command void printBitVec(char *buf, uint8_t *bitVec, uint16_t length)
- Parameters:
-
buf
- the character array to place the ASCII string
-
bitVec
- the bit vector
-
length
- the length of the bit vector in bits