aboutsummaryrefslogtreecommitdiffstats
path: root/chilbert/SetBits.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-07 19:47:16 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 14:46:18 +0200
commit9fde28df12c6f9d45e9fcb60d6a609e416a1371a (patch)
tree8c2a24a7a344e15bd9b740202ae06f81dafe69f6 /chilbert/SetBits.hpp
parent12a5b1aa57976b6a2be04efd224b7109df702f52 (diff)
downloadchilbert-9fde28df12c6f9d45e9fcb60d6a609e416a1371a.tar.gz
chilbert-9fde28df12c6f9d45e9fcb60d6a609e416a1371a.tar.bz2
chilbert-9fde28df12c6f9d45e9fcb60d6a609e416a1371a.zip
Clean up remaining code and format consistently with clang-format
Diffstat (limited to 'chilbert/SetBits.hpp')
-rw-r--r--chilbert/SetBits.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/chilbert/SetBits.hpp b/chilbert/SetBits.hpp
index 6b2cd24..1a4874b 100644
--- a/chilbert/SetBits.hpp
+++ b/chilbert/SetBits.hpp
@@ -23,11 +23,16 @@
namespace chilbert {
+/** Set a range of bits in one field from the start of another.
+ *
+ * @param h Destination bit field
+ * @param n Number of bits
+ * @param i Start bit index in destination
+ * @param w Source bit field
+ */
template <class H, class I>
-inline void setBits(H& h, // destination
- const int n, // number of bits
- const int i, // bit position
- const I& w) // bits to place
+inline void
+setBits(H& h, const int n, const int i, const I& w)
{
for (int j = 0; j < n; j++) {
setBit(h, i + j, testBit(w, j));