On Saturday, 30 January 2021 at 14:56:14 UTC, burt wrote:
On Saturday, 30 January 2021 at 14:41:59 UTC, Afgdr wrote:On Saturday, 30 January 2021 at 14:40:49 UTC, Afgdr wrote:On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote:[...]cast as uint and shift. cast the result as ubyte[4].obiously, that works for n=4 with uint and n=8 for ulong, only.Yes I used to do this, but then I needed it for n > 8.
As suggested in the other answer BitArray may be the best generic solution.