Use BigInteger for int128 and int256

This commit is contained in:
Lonami Exo 2018-07-23 23:18:08 +02:00
parent 2d442c390c
commit f8f80c1659
2 changed files with 11 additions and 6 deletions

View File

@ -54,6 +54,7 @@ public class Generator {
writer.write("import io.github.lonamiwebs.overgram.utils.BinaryReader;\n");
writer.write("import io.github.lonamiwebs.overgram.utils.BinaryWriter;\n");
writer.write("import java.util.List;\n");
writer.write("import java.math.BigInteger;\n");
writer.write("@SuppressWarnings(\"ALL\")\n");
writer.write("public class ");
writer.write(className);
@ -251,11 +252,14 @@ public class Generator {
writer.write("reader.readInt();");
break;
case "long":
// TODO handle int128 and int256 properly
case "int128":
case "int256":
writer.write("reader.readLong();");
break;
case "int128":
writer.write("reader.readInt128();");
break;
case "int256":
writer.write("reader.readInt256();");
break;
case "double":
writer.write("reader.readDouble();");
break;

View File

@ -78,15 +78,16 @@ public class TLArg {
}
break;
case "long":
// TODO handle int128 and int256 properly
case "int128":
case "int256":
if (flag == null && !nested) {
builder.append("long");
} else {
builder.append("Long");
}
break;
case "int128":
case "int256":
builder.append("BigInteger");
break;
case "double":
if (flag == null && !nested) {
builder.append("double");