@@ -144,6 +144,7 @@ initDefs tgt =
144144 , exfun "mpz_init_set_sll" VoidType [pmpz, IntegerType 64] False
145145 , exfun "__idris_strCons" ptrI8 [IntegerType 8, ptrI8] False
146146 , exfun "__idris_readStr" ptrI8 [ptrI8] False -- Actually pointer to FILE, but it's opaque anyway
147+ , exfun "strtoll" (IntegerType 64) [ptrI8, PointerType ptrI8 (AddrSpace 0), IntegerType 32] False
147148 , exVar "stdin" ptrI8
148149 , exVar "stdout" ptrI8
149150 , exVar "stderr" ptrI8
@@ -814,6 +815,22 @@ cgOp (LIntStr ity) [x] = do
814815 then inst $ SExt x' (IntegerType 64) []
815816 else return x'
816817 box FString =<< inst (idrCall "__idris_intStr" [x''])
818+cgOp (LStrInt ITBig) [s] = do
819+ ns <- unbox FString s
820+ mpz <- alloc mpzTy
821+ inst $ simpleCall "__gmpz_init_set_str" [mpz, ns, ConstantOperand $ C.Int 32 10]
822+ box (FInt ITBig) mpz
823+cgOp (LStrInt ity) [s] = do
824+ ns <- unbox FString s
825+ nx <- inst $ simpleCall "strtoll"
826+ [ns
827+ , ConstantOperand $ C.Null (PointerType (PointerType (IntegerType 8) (AddrSpace 0)) (AddrSpace 0))
828+ , ConstantOperand $ C.Int 32 10
829+ ]
830+ nx' <- case ity of
831+ IT64 -> return nx
832+ _ -> inst $ Trunc nx (IntegerType (itWidth ity)) []
833+ box (FInt ity) nx'
817834
818835cgOp LStrConcat [x,y] = cgStrCat x y
819836