diff options
Diffstat (limited to 'chilbert/GetBits.hpp')
-rw-r--r-- | chilbert/GetBits.hpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/chilbert/GetBits.hpp b/chilbert/GetBits.hpp index 9a6d5ec..66f6f32 100644 --- a/chilbert/GetBits.hpp +++ b/chilbert/GetBits.hpp @@ -23,11 +23,16 @@ namespace chilbert { +/** Copy a range of bits from one field to the start of another. + * + * @param h Source bit field + * @param n Number of bits + * @param i Start bit index in source + * @param w Destination bit field + */ template <class H, class I> -inline void getBits(const H& h, // bits to read - const int n, // number of bits - const int i, // bit index - I& w) // destination +inline void +getBits(const H& h, const int n, const int i, I& w) { for (int j = 0; j < n; j++) { setBit(w, j, testBit(h, i + j)); |