|
spinn_common 7.4.2
Support code for SpiNNaker applications.
|
Bit field manipulation. More...
#include <stdint.h>#include <stdbool.h>Go to the source code of this file.
Functions | |
| static bool | bit_field_test (bit_field_t b, index_t n) |
| This function tests a particular bit of a bit_field. | |
| static void | bit_field_clear (bit_field_t restrict b, index_t n) |
| This function clears a particular bit of a bit_field. | |
| static void | bit_field_set (bit_field_t restrict b, index_t n) |
| This function sets a particular bit of a bit_field. | |
| static void | not_bit_field (bit_field_t restrict b, size_t s) |
| This function negates the bits of an entire bit_field. | |
| static void | and_bit_fields (bit_field_t restrict b1, const bit_field_t restrict b2, size_t s) |
| This function ands two bit_fields together. | |
| static void | or_bit_fields (bit_field_t restrict b1, const bit_field_t restrict b2, size_t s) |
| This function ors two bit_fields together. | |
| static void | clear_bit_field (bit_field_t restrict b, size_t s) |
| This function clears an entire bit_field. | |
| static void | set_bit_field (bit_field_t restrict b, size_t s) |
| This function sets an entire bit_field. | |
| static bool | empty_bit_field (const bit_field_t restrict b, size_t s) |
| This function tests whether a bit_field is all zeros. | |
| static bool | nonempty_bit_field (const bit_field_t restrict b, size_t s) |
| Testing whether a bit_field is non-empty, i.e. if there is at least one bit set. | |
| static size_t | get_bit_field_size (size_t bits) |
| A function that calculates the size of a bit_field to hold 'bits' bits. | |
| static int | count_bit_field (const bit_field_t restrict b, size_t s) |
| Computes the number of set bits in a bit_field. | |
| void | print_bit_field_bits (const bit_field_t restrict b, size_t s) |
| This function prints out an entire bit_field, as a sequence of ones and zeros. | |
| void | print_bit_field (const bit_field_t restrict b, size_t s) |
| This function prints out an entire bit_field, as a sequence of hexadecimal numbers, one per line. | |
| void | random_bit_field (bit_field_t restrict b, size_t s) |
| Generates a random bit_field for testing purposes. | |
| bit_field_t | bit_field_alloc (uint32_t n_atoms) |
| allocates a bit_field_t object | |
Bit field manipulation.
A bit field is a vector of machine words which is treated as a vector of bits.
For SpiNNaker each machine word is 32 bits, and so a bit_field for each neuron (assuming 256 neurons) would be 8 words long.
The API includes:
There are also support functions for:
|
inlinestatic |
This function tests a particular bit of a bit_field.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | n | The size of the bit_field. |
|
inlinestatic |
This function clears a particular bit of a bit_field.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | n | The size of the bit_field. |
|
inlinestatic |
This function sets a particular bit of a bit_field.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | n | The bit in the bit_field of interest. |
|
inlinestatic |
This function negates the bits of an entire bit_field.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
|
inlinestatic |
This function ands two bit_fields together.
| [in,out] | b1 | The sequence of words representing the first bit_field; the result is returned in this parameter. |
| [in] | b2 | The sequence of words representing the second bit_field. |
| [in] | s | The size of the bit_field. |
|
inlinestatic |
This function ors two bit_fields together.
| [in,out] | b1 | The sequence of words representing the first bit_field; the result is returned in this parameter. |
| [in] | b2 | The sequence of words representing the second bit_field. |
| [in] | s | The size of the bit_field. |
|
inlinestatic |
This function clears an entire bit_field.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
|
inlinestatic |
This function sets an entire bit_field.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
|
inlinestatic |
This function tests whether a bit_field is all zeros.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
|
inlinestatic |
Testing whether a bit_field is non-empty, i.e. if there is at least one bit set.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
A function that calculates the size of a bit_field to hold 'bits' bits.
| [in] | bits | The number of bits required for this bit_field. |
|
inlinestatic |
Computes the number of set bits in a bit_field.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
| void print_bit_field_bits | ( | const bit_field_t restrict | b, |
| size_t | s | ||
| ) |
This function prints out an entire bit_field, as a sequence of ones and zeros.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
| void print_bit_field | ( | const bit_field_t restrict | b, |
| size_t | s | ||
| ) |
This function prints out an entire bit_field, as a sequence of hexadecimal numbers, one per line.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
| void random_bit_field | ( | bit_field_t restrict | b, |
| size_t | s | ||
| ) |
Generates a random bit_field for testing purposes.
| [in] | b | The sequence of words representing a bit_field. |
| [in] | s | The size of the bit_field. |
| bit_field_t bit_field_alloc | ( | uint32_t | n_atoms | ) |
allocates a bit_field_t object
| [in] | n_atoms | the number of atoms to cover with this bitfield |