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

View File

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