diff --git a/prompts/10-bit-container b/prompts/10-bit-container new file mode 100644 index 0000000..4532a9a --- /dev/null +++ b/prompts/10-bit-container @@ -0,0 +1,10 @@ +We're using c++20, I want you to create a file wfc_bit_container.hpp in include\nd-wfc which contains a templated class whose goal is to minimize the amount of bits we use for masking. The template type should be a number (The number of bits stored) and should have the Size of the container (how many of these integers should we store). The size is 0 by default, which means it's resizable and it should use an std::vector instead of an std::array. +examples of given parameters: +- Bits: 2; Size: 8; -> 2 requires 2 bits, std::array +- Bits: 3; size: 4; -> 3 requires 4 bits, std::array +- Bits: 0; size 128; -> 0*128 == 0; std::array +- Bits: 32; size: 100; -> std::array +- Bits: 256; size: 0; -> std::vector +Make sure that the amount of bits used is a power of 2: 0, 1, 2, 4, 8, 16, 32, 64. If more than 64 bits are required, make sure it is a multiple of 64: 64, 128, 196, 256, etc. +We should be able to get/set values with an index, do bit operations like |, &, ^ on individual elements, do std::countl_zero, std::countl_one, std::countr_zero, std::countr_one & std::popcount. +This repo tries to be as optimized as possible. Make good use of `asserts` instead of `if conditions` wherever you are checking something. \ No newline at end of file