equal
deleted
inserted
replaced
229 let |
229 let |
230 fun dest_bit (IConst (c, _)) = if c = c_bit0 then SOME 0 |
230 fun dest_bit (IConst (c, _)) = if c = c_bit0 then SOME 0 |
231 else if c = c_bit1 then SOME 1 |
231 else if c = c_bit1 then SOME 1 |
232 else NONE |
232 else NONE |
233 | dest_bit _ = NONE; |
233 | dest_bit _ = NONE; |
234 fun dest_numeral (IConst (c, _)) = if c = c_pls then SOME 0 |
234 fun dest_numeral (IConst (c, _)) = if c = c_pls then SOME (IntInf.fromInt 0) |
235 else if c = c_min then SOME ~1 |
235 else if c = c_min then SOME (IntInf.fromInt ~1) |
236 else NONE |
236 else NONE |
237 | dest_numeral (IConst (c, _) `$ t1 `$ t2) = |
237 | dest_numeral (IConst (c, _) `$ t1 `$ t2) = |
238 if c = c_bit then case (dest_numeral t1, dest_bit t2) |
238 if c = c_bit then case (dest_numeral t1, dest_bit t2) |
239 of (SOME n, SOME b) => SOME (2 * n + IntInf.fromInt b) |
239 of (SOME n, SOME b) => SOME (IntInf.fromInt 2 * n + IntInf.fromInt b) |
240 | _ => NONE |
240 | _ => NONE |
241 else NONE |
241 else NONE |
242 | dest_numeral _ = NONE; |
242 | dest_numeral _ = NONE; |
243 in dest_numeral end; |
243 in dest_numeral end; |
244 |
244 |