FastLED 3.9.15
Loading...
Searching...
No Matches
bitset.cpp
Go to the documentation of this file.
1#include "fl/bitset.h"
2
3#include "fl/string.h"
4
5namespace fl {
6
7namespace detail {
8void to_string(const fl::u16 *bit_data, fl::u32 bit_count, string* dst) {
9 fl::string& result = *dst;
10 constexpr fl::u32 bits_per_block = 8 * sizeof(fl::u16); // 16 bits per block
11
12 for (fl::u32 i = 0; i < bit_count; ++i) {
13 const fl::u32 block_idx = i / bits_per_block;
14 const fl::u32 bit_offset = i % bits_per_block;
15
16 // Extract the bit from the block
17 bool bit_value = (bit_data[block_idx] >> bit_offset) & 1;
18 result.append(bit_value ? "1" : "0");
19 }
20}
21} // namespace detail
22
23// Implementation for bitset_dynamic::to_string
24void bitset_dynamic::to_string(string* dst) const {
26}
27
28} // namespace fl
block_type * _blocks
FL_DISABLE_WARNING_POP void to_string(string *dst) const
Definition bitset.cpp:24
Result type for promise operations.
void to_string(const fl::u16 *bit_data, fl::u32 bit_count, string *dst)
Definition bitset.cpp:8
IMPORTANT!
Definition crgb.h:20