From eae444df7782ed2c2a67d4ab6bb4880b75d2652a Mon Sep 17 00:00:00 2001 From: Kai Chappell Date: Wed, 3 Sep 2025 23:27:24 +0100 Subject: [PATCH] feat(viz): bit manipulation types --- frontend/src/lib/visualizations/types.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/frontend/src/lib/visualizations/types.ts b/frontend/src/lib/visualizations/types.ts index 5ef21ba..91581c8 100644 --- a/frontend/src/lib/visualizations/types.ts +++ b/frontend/src/lib/visualizations/types.ts @@ -99,6 +99,8 @@ export interface DataState { tries?: TrieState[]; // Union-Find support unionFind?: UnionFindState[]; + // Bit Manipulation support + bitManipulation?: BitManipulationState[]; } /** Single step in the visualization */ @@ -382,6 +384,28 @@ export interface TrieState { searchIndex?: number; // Current character index } +// ============================================ +// Bit Manipulation Types +// ============================================ + +/** State of a bit representation display */ +export interface BitState { + id: string; + value: number; + bits: string; // Binary string like "0010" + label?: string; + state: 'normal' | 'highlighted' | 'comparing' | 'result' | 'cancelled'; +} + +/** Complete bit manipulation state */ +export interface BitManipulationState { + id: string; + operands: BitState[]; + operation?: 'XOR' | 'AND' | 'OR' | 'NOT'; + result?: BitState; + label?: string; +} + // ============================================ // Union-Find Types // ============================================