@@ -11,36 +11,36 @@ let make = (varA: string, varB: string, varQ: string, varR: string): Instruction
1111 instructionType : "DIV" ,
1212 args : [varA , varB , varQ , varR ],
1313 execute : state => {
14- let valA = Js . Dict .get (state , varA )-> Belt .Option .getWithDefault (0 )
15- let valB = Js . Dict .get (state , varB )-> Belt .Option .getWithDefault (1 ) // Avoid division by zero
14+ let valA = Dict .get (state , varA )-> Belt .Option .getWithDefault (0 )
15+ let valB = Dict .get (state , varB )-> Belt .Option .getWithDefault (1 ) // Avoid division by zero
1616
1717 if valB == 0 {
1818 // Division by zero - store error state
19- Js . Dict .set (state , varQ , 0 )
20- Js . Dict .set (state , varR , valA ) // Store original value in remainder
19+ Dict .set (state , varQ , 0 )
20+ Dict .set (state , varR , valA ) // Store original value in remainder
2121 } else {
2222 // Normal division: q = a / b, r = a mod b
2323 let quotient = valA / valB
2424 let remainder = mod (valA , valB )
2525
26- Js . Dict .set (state , varQ , quotient )
27- Js . Dict .set (state , varR , remainder )
26+ Dict .set (state , varQ , quotient )
27+ Dict .set (state , varR , remainder )
2828 }
2929 },
3030 invert : state => {
3131 // Inverse: reconstruct a from quotient and remainder
3232 // a = (q * b) + r
33- let valB = Js . Dict .get (state , varB )-> Belt .Option .getWithDefault (1 )
34- let valQ = Js . Dict .get (state , varQ )-> Belt .Option .getWithDefault (0 )
35- let valR = Js . Dict .get (state , varR )-> Belt .Option .getWithDefault (0 )
33+ let valB = Dict .get (state , varB )-> Belt .Option .getWithDefault (1 )
34+ let valQ = Dict .get (state , varQ )-> Belt .Option .getWithDefault (0 )
35+ let valR = Dict .get (state , varR )-> Belt .Option .getWithDefault (0 )
3636
3737 let _reconstructed = (valQ * valB ) + valR
3838 // In a full implementation, we might restore varA here:
39- // Js. Dict.set(state, varA, reconstructed)
39+ // Dict.set(state, varA, reconstructed)
4040
4141 // Clear quotient and remainder (ancilla cleanup)
42- Js . Dict .set (state , varQ , 0 )
43- Js . Dict .set (state , varR , 0 )
42+ Dict .set (state , varQ , 0 )
43+ Dict .set (state , varR , 0 )
4444
4545 // Note: We don't restore varA here because DIV is typically used
4646 // to compute quotient/remainder, not to transform the dividend
@@ -52,16 +52,16 @@ let makeSimple = (varA: string, varB: string, varQ: string): Instruction.t => {
5252 instructionType : "DIV_SIMPLE" ,
5353 args : [varA , varB , varQ ],
5454 execute : state => {
55- let valA = Js . Dict .get (state , varA )-> Belt .Option .getWithDefault (0 )
56- let valB = Js . Dict .get (state , varB )-> Belt .Option .getWithDefault (1 )
55+ let valA = Dict .get (state , varA )-> Belt .Option .getWithDefault (0 )
56+ let valB = Dict .get (state , varB )-> Belt .Option .getWithDefault (1 )
5757
5858 if valB != 0 {
5959 let quotient = valA / valB
60- Js . Dict .set (state , varQ , quotient )
60+ Dict .set (state , varQ , quotient )
6161 }
6262 },
6363 invert : state => {
6464 // Clear the quotient
65- Js . Dict .set (state , varQ , 0 )
65+ Dict .set (state , varQ , 0 )
6666 },
6767}
0 commit comments