diff --git a/canvas/src/blocks/value-view/utils/bits-to-list.ts b/canvas/src/blocks/value-view/utils/bits-to-list.ts index 6d9b95f..76dfea8 100644 --- a/canvas/src/blocks/value-view/utils/bits-to-list.ts +++ b/canvas/src/blocks/value-view/utils/bits-to-list.ts @@ -1,6 +1,15 @@ export const bitsToList = (nums: number[]): boolean[][] => nums.map((n) => { - // console.log(`n -> ${n.toString(2)}`) + const value = n.toString(2).split("").map(Number).map(Boolean) - return n.toString(2).padEnd(8, "0").split("").map(Number).map(Boolean) + if (value.length < 16) { + const pad = Math.ceil(value.length / 8) * 8 + const needed = pad - value.length + + if (needed > 0) { + for (let i = 0; i < needed; i++) value.push(false) + } + } + + return value })