on master help sign in
Merge pull request #334 from JanBessai/master
06a7456Edwin Brady
java/src/main/java/org/idris/rts/ForeignPrimitives.java+2−2
@@ -209,9 +209,9 @@ public class ForeignPrimitives {
209 buf = null;
209 buf = null;
210 }
210 }
211
211
212− public static Integer idris_peek(Object buf, int offset) {
212+ public static byte idris_peek(Object buf, int offset) {
213 ByteBuffer buffer = (ByteBuffer)buf;
213 ByteBuffer buffer = (ByteBuffer)buf;
214− return Integer.valueOf(buffer.get(offset));
214+ return buffer.get(offset);
215 }
215 }
216
216
217 public static void idris_poke(Object buf, int offset, Object data) {
217 public static void idris_poke(Object buf, int offset, Object data) {
src/IRTS/CodegenJava.hs+2−12
@@ -1375,10 +1375,7 @@ mkExp (SOp LStrLen [arg]) =
1375mkExp (SOp (LIntFloat ity) [arg]) =
1375mkExp (SOp (LIntFloat ity) [arg]) =
1376 mkPrimitiveCast (intTyToClass ity) doubleType arg
1376 mkPrimitiveCast (intTyToClass ity) doubleType arg
1377mkExp (SOp (LFloatInt ity) [arg]) =
1377mkExp (SOp (LFloatInt ity) [arg]) =
1378− mkPrimitiveCast doubleType (intTyToClass ity) arg
1378+ mkSignedExt (intTyToMethod ity) doubleType (intTyToClass ity) arg
1379−mkExp (SOp (LIntStr ITBig) [arg]) =
1380− (\ var -> InstanceCreation [] bigIntegerType [var] Nothing)
1381− <$> mkVarAccess (Just stringType) arg
1382mkExp (SOp (LIntStr ity) [arg]) =
1379mkExp (SOp (LIntStr ity) [arg]) =
1383 mkToString (intTyToClass ity) arg
1380 mkToString (intTyToClass ity) arg
1384mkExp (SOp (LStrInt ity) [arg]) =
1381mkExp (SOp (LStrInt ity) [arg]) =
@@ -1486,14 +1483,7 @@ mkExp (SOp (LSExt from to) [var])
1486 = mkSignedExt (intTyToMethod to) (intTyToClass from) (intTyToClass to) var
1483 = mkSignedExt (intTyToMethod to) (intTyToClass from) (intTyToClass to) var
1487mkExp (SOp (LTrunc from to) [var])
1484mkExp (SOp (LTrunc from to) [var])
1488 | intTyWidth from > intTyWidth to
1485 | intTyWidth from > intTyWidth to
1489− = (\ var -> MethodInv $
1490− TypeMethodCall (J.Name [intTyToIdent to])
1491− []
1492− (Ident "valueOf")
1493− [ MethodInv
1494− $ PrimaryMethodCall var [] (Ident (intTyToMethod to)) [] ]
1495− )
1496− <$> mkVarAccess (Just $ intTyToClass from) var
1486+ = mkSignedExt (intTyToMethod to) (intTyToClass from) (intTyToClass to) var
1497mkExp (SOp LFExp [arg]) = mkMathFun "exp" arg
1487mkExp (SOp LFExp [arg]) = mkMathFun "exp" arg
1498mkExp (SOp LFLog [arg]) = mkMathFun "log" arg
1488mkExp (SOp LFLog [arg]) = mkMathFun "log" arg
1499mkExp (SOp LFSin [arg]) = mkMathFun "sin" arg
1489mkExp (SOp LFSin [arg]) = mkMathFun "sin" arg