@@ -10,7 +10,10 @@ import java.math.BigInteger;
10public class PrimFn {
10public class PrimFn {
11 public static byte LPlus(byte x, byte y) {
11 public static byte LPlus(byte x, byte y) {
12 return (byte)(x + y);
12 return (byte)(x + y);
14+ public static char LPlus(char x, char y) {
15+ return (char)(x + y);
14 public static short LPlus(short x, short y) {
17 public static short LPlus(short x, short y) {
15 return (short)(x + y);
18 return (short)(x + y);
@@ -57,7 +60,10 @@ public class PrimFn {
58 public static byte LMinus(byte x, byte y) {
61 public static byte LMinus(byte x, byte y) {
59 return (byte)(x - y);
62 return (byte)(x - y);
64+ public static char LMinus(char x, char y) {
65+ return (char)(x - y);
61 public static short LMinus(short x, short y) {
67 public static short LMinus(short x, short y) {
62 return (short)(x - y);
68 return (short)(x - y);
@@ -104,7 +110,10 @@ public class PrimFn {
105 public static byte LTimes(byte x, byte y) {
111 public static byte LTimes(byte x, byte y) {
106 return (byte)(x * y);
112 return (byte)(x * y);
114+ public static char LTimes(char x, char y) {
115+ return (char)(x * y);
108 public static short LTimes(short x, short y) {
117 public static short LTimes(short x, short y) {
109 return (short)(x * y);
118 return (short)(x * y);
@@ -151,7 +160,10 @@ public class PrimFn {
152 public static byte LUDiv(byte x, byte y) {
161 public static byte LUDiv(byte x, byte y) {
153 return (byte)(((short)x) / ((short)y));
162 return (byte)(((short)x) / ((short)y));
164+ public static char LUDiv(char x, char y) {
165+ return (char)(((long)x) / ((long)y));
155 public static short LUDiv(short x, short y) {
167 public static short LUDiv(short x, short y) {
156 return (short)(((int)x) / ((int)y));
168 return (short)(((int)x) / ((int)y));
@@ -192,7 +204,10 @@ public class PrimFn {
193 public static byte LSDiv(byte x, byte y) {
205 public static byte LSDiv(byte x, byte y) {
194 return (byte)(x / y);
206 return (byte)(x / y);
208+ public static char LSDiv(char x, char y) {
209+ return (char)(x / y);
196 public static short LSDiv(short x, short y) {
211 public static short LSDiv(short x, short y) {
197 return (short)(x / y);
212 return (short)(x / y);
@@ -240,6 +255,9 @@ public class PrimFn {
240 public static byte LURem(byte x, byte y) {
255 public static byte LURem(byte x, byte y) {
241 return (byte)(((short)x) % ((short)y));
256 return (byte)(((short)x) % ((short)y));
258+ public static char LURem(char x, char y) {
259+ return (char)(((long)x) % ((long)y));
243 public static short LURem(short x, short y) {
261 public static short LURem(short x, short y) {
244 return (short)(((int)x) % ((int)y));
262 return (short)(((int)x) % ((int)y));
@@ -280,7 +298,10 @@ public class PrimFn {
281 public static byte LSRem(byte x, byte y) {
299 public static byte LSRem(byte x, byte y) {
282 return (byte)(x % y);
300 return (byte)(x % y);
302+ public static char LSRem(char x, char y) {
303+ return (char)(x % y);
284 public static short LSRem(short x, short y) {
305 public static short LSRem(short x, short y) {
285 return (short)(x % y);
306 return (short)(x % y);
@@ -328,7 +349,10 @@ public class PrimFn {
329 public static byte LAnd(byte x, byte y) {
350 public static byte LAnd(byte x, byte y) {
330 return (byte)(x & y);
351 return (byte)(x & y);
353+ public static char LAnd(char x, char y) {
354+ return (char)(x & y);
332 public static short LAnd(short x, short y) {
356 public static short LAnd(short x, short y) {
333 return (short)(x & y);
357 return (short)(x & y);
@@ -372,7 +396,10 @@ public class PrimFn {
373 public static byte LOr(byte x, byte y) {
397 public static byte LOr(byte x, byte y) {
374 return (byte)(x | y);
398 return (byte)(x | y);
400+ public static char LOr(char x, char y) {
401+ return (char)(x | y);
376 public static short LOr(short x, short y) {
403 public static short LOr(short x, short y) {
377 return (short)(x | y);
404 return (short)(x | y);
@@ -416,7 +443,10 @@ public class PrimFn {
417 public static byte LXOr(byte x, byte y) {
444 public static byte LXOr(byte x, byte y) {
418 return (byte)(x ^ y);
445 return (byte)(x ^ y);
447+ public static char LXOr(char x, char y) {
448+ return (char)(x ^ y);
420 public static short LXOr(short x, short y) {
450 public static short LXOr(short x, short y) {
421 return (short)(x ^ y);
451 return (short)(x ^ y);
@@ -460,7 +490,10 @@ public class PrimFn {
461 public static byte LCompl(byte x) {
491 public static byte LCompl(byte x) {
462 return (byte)~x;
492 return (byte)~x;
494+ public static char LCompl(char x) {
464 public static short LCompl(short x) {
497 public static short LCompl(short x) {
465 return (short)(~x);
498 return (short)(~x);
@@ -504,7 +537,10 @@ public class PrimFn {
505 public static byte LSHL(byte x, byte y) {
538 public static byte LSHL(byte x, byte y) {
506 return (byte)(x << y);
539 return (byte)(x << y);
541+ public static char LSHL(char x, char y) {
542+ return (char)(x << y);
508 public static short LSHL(short x, short y) {
544 public static short LSHL(short x, short y) {
509 return (short)(x << y);
545 return (short)(x << y);
@@ -549,6 +585,9 @@ public class PrimFn {
549 public static byte LLSHR(byte x, byte y) {
585 public static byte LLSHR(byte x, byte y) {
550 return (byte)(x >>> y);
586 return (byte)(x >>> y);
588+ public static char LLSHR(char x, char y) {
589+ return (char)(x >>> y);
552 public static short LLSHR(short x, short y) {
591 public static short LLSHR(short x, short y) {
553 return (short)(x >>> y);
592 return (short)(x >>> y);
@@ -589,7 +628,10 @@ public class PrimFn {
590 public static byte LASHR(byte x, byte y) {
629 public static byte LASHR(byte x, byte y) {
591 return (byte)(x >> y);
630 return (byte)(x >> y);
632+ public static char LASHR(char x, char y) {
633+ return (char)(x >> y);
593 public static short LASHR(short x, short y) {
635 public static short LASHR(short x, short y) {
594 return (short)(x >> y);
636 return (short)(x >> y);
@@ -633,7 +675,10 @@ public class PrimFn {
634 public static int LEq(byte x, byte y) {
676 public static int LEq(byte x, byte y) {
635 return (x == y ? 1 : 0);
677 return (x == y ? 1 : 0);
679+ public static int LEq(char x, char y) {
680+ return (x == y ? 1 : 0);
637 public static int LEq(short x, short y) {
682 public static int LEq(short x, short y) {
638 return (x == y ? 1 : 0);
683 return (x == y ? 1 : 0);
@@ -680,7 +725,10 @@ public class PrimFn {
681 public static int LLt(byte x, byte y) {
726 public static int LLt(byte x, byte y) {
682 return (x < y ? 1 : 0);
727 return (x < y ? 1 : 0);
729+ public static int LLt(char x, char y) {
730+ return (x < y ? 1 : 0);
684 public static int LLt(short x, short y) {
732 public static int LLt(short x, short y) {
685 return (x < y ? 1 : 0);
733 return (x < y ? 1 : 0);
@@ -727,7 +775,10 @@ public class PrimFn {
728 public static int LLe(byte x, byte y) {
776 public static int LLe(byte x, byte y) {
729 return (x <= y ? 1 : 0);
777 return (x <= y ? 1 : 0);
779+ public static int LLe(char x, char y) {
780+ return (x <= y ? 1 : 0);
731 public static int LLe(short x, short y) {
782 public static int LLe(short x, short y) {
732 return (x <= y ? 1 : 0);
783 return (x <= y ? 1 : 0);
@@ -775,6 +826,9 @@ public class PrimFn {
775 public static int LGt(byte x, byte y) {
826 public static int LGt(byte x, byte y) {
776 return (x > y ? 1 : 0);
827 return (x > y ? 1 : 0);
829+ public static int LGt(char x, char y) {
830+ return (x > y ? 1 : 0);
778 public static int LGt(short x, short y) {
832 public static int LGt(short x, short y) {
779 return (x > y ? 1 : 0);
833 return (x > y ? 1 : 0);
@@ -821,7 +875,10 @@ public class PrimFn {
822 public static int LGe(byte x, byte y) {
876 public static int LGe(byte x, byte y) {
823 return (x >= y ? 1 : 0);
877 return (x >= y ? 1 : 0);
879+ public static int LGe(char x, char y) {
880+ return (x >= y ? 1 : 0);
825 public static int LGe(short x, short y) {
882 public static int LGe(short x, short y) {
826 return (x >= y ? 1 : 0);
883 return (x >= y ? 1 : 0);
@@ -901,6 +958,19 @@ public class PrimFn {
901 return res;
958 return res;
961+ public static short LSExtIT16(char x) {
964+ public static int LSExtIT32(char x) {
967+ public static long LSExtIT64(char x) {
970+ public static BigInteger LSExtITBig(char x) {
971+ return BigInteger.valueOf(x);
904 public static int LSExtIT32(short x) {
974 public static int LSExtIT32(short x) {
905 return (int)x;
975 return (int)x;
@@ -955,6 +1025,9 @@ public class PrimFn {
955 public static BigInteger LZExtITBig(byte x) {
1025 public static BigInteger LZExtITBig(byte x) {
956 return BigInteger.valueOf(x < 0 ? x + (2 << 7) : x);
1026 return BigInteger.valueOf(x < 0 ? x + (2 << 7) : x);
1028+ public static char LZExtITChar(byte x) {
1029+ return (char)(x < 0 ? x + (2 << 7) : x);
958 public static short[] LZExtITVec16(byte[] x) {
1031 public static short[] LZExtITVec16(byte[] x) {
959 short[] res = new short[x.length];
1032 short[] res = new short[x.length];
960 for (int i = 0; i < res.length; ++i) {
1033 for (int i = 0; i < res.length; ++i) {
@@ -976,7 +1049,7 @@ public class PrimFn {
977 return res;
1050 return res;
980 public static int LZExtIT32(short x) {
1053 public static int LZExtIT32(short x) {
981 return (int)(x < 0 ? x + (2 << 15) : x);
1054 return (int)(x < 0 ? x + (2 << 15) : x);
@@ -986,6 +1059,9 @@ public class PrimFn {
986 public static BigInteger LZExtITBig(short x) {
1059 public static BigInteger LZExtITBig(short x) {
987 return BigInteger.valueOf(x < 0 ? x + (2 << 15) : x);
1060 return BigInteger.valueOf(x < 0 ? x + (2 << 15) : x);
1062+ public static char LZExtITChar(short x) {
1063+ return (char)(x < 0 ? x + (2 << 15) : x);
989 public static int[] LZExtITVec32(short[] x) {
1065 public static int[] LZExtITVec32(short[] x) {
990 int[] res = new int[x.length];
1066 int[] res = new int[x.length];
991 for (int i = 0; i < res.length; ++i) {
1067 for (int i = 0; i < res.length; ++i) {
@@ -1007,6 +1083,9 @@ public class PrimFn {
1007 public static BigInteger LZExtITBig(int x) {
1083 public static BigInteger LZExtITBig(int x) {
1008 return BigInteger.valueOf(x < 0 ? ((long)x) + (2 << 31) : x);
1084 return BigInteger.valueOf(x < 0 ? ((long)x) + (2 << 31) : x);
1086+ public static char LZExtITChar(int x) {
1087+ return (char)(x < 0 ? ((long)x) + (2 << 31) : x);
1010 public static long[] LZExtITVec64(int[] x) {
1089 public static long[] LZExtITVec64(int[] x) {
1011 long[] res = new long[x.length];
1090 long[] res = new long[x.length];
1012 for (int i = 0; i < res.length; ++i) {
1091 for (int i = 0; i < res.length; ++i) {
@@ -1018,6 +1097,9 @@ public class PrimFn {
1018 public static BigInteger LZExtITBig(long x) {
1097 public static BigInteger LZExtITBig(long x) {
1019 return (x < 0 ? BigInteger.valueOf(x).add(BigInteger.valueOf(2).shiftLeft(61)) : BigInteger.valueOf(x));
1098 return (x < 0 ? BigInteger.valueOf(x).add(BigInteger.valueOf(2).shiftLeft(61)) : BigInteger.valueOf(x));
1100+ public static char LZExtITChar(long x) {
1101+ return (char)((x < 0 ? BigInteger.valueOf(x).add(BigInteger.valueOf(2).shiftLeft(61)) : BigInteger.valueOf(x)).intValue());
1022 public static byte LTruncIT8(short x) {
1104 public static byte LTruncIT8(short x) {
1023 return (byte)x;
1105 return (byte)x;
@@ -1029,6 +1111,9 @@ public class PrimFn {
1030 return res;
1112 return res;
1114+ public static char LTruncITChar(short x) {
1033 public static byte LTruncIT8(int x) {
1118 public static byte LTruncIT8(int x) {
1034 return (byte)x;
1119 return (byte)x;
@@ -1050,6 +1135,9 @@ public class PrimFn {
1051 return res;
1136 return res;
1138+ public static char LTruncITChar(int x) {
1054 public static byte LTruncIT8(long x) {
1142 public static byte LTruncIT8(long x) {
1055 return (byte)x;
1143 return (byte)x;
@@ -1081,6 +1169,9 @@ public class PrimFn {
1082 return res;
1170 return res;
1172+ public static char LTruncITChar(long x) {
1085 public static byte LTruncIT8(BigInteger x) {
1176 public static byte LTruncIT8(BigInteger x) {
1086 return x.byteValue();
1177 return x.byteValue();
@@ -1094,6 +1185,25 @@ public class PrimFn {
1094 public static long LTruncIT64(BigInteger x) {
1185 public static long LTruncIT64(BigInteger x) {
1095 return x.longValue();
1186 return x.longValue();
1188+ public static char LTruncITChar(BigInteger x) {
1189+ return (char)x.intValue();
1192+ public static byte LTruncIT8(char x) {
1195+ public static short LTruncIT16(char x) {
1198+ public static int LTruncIT32(char x) {
1201+ public static long LTruncIT64(char x) {
1204+ public static BigInteger LTruncITBig(char x) {
1205+ return BigInteger.valueOf(x);
1099 public static double LFExp(double x) {
1209 public static double LFExp(double x) {
@@ -1196,6 +1306,9 @@ public class PrimFn {
1196 public static double LIntFloat(byte x) {
1306 public static double LIntFloat(byte x) {
1197 return (double)x;
1307 return (double)x;
1309+ public static double LIntFloat(char x) {
1199 public static double LIntFloat(short x) {
1312 public static double LIntFloat(short x) {
1200 return (double)x;
1313 return (double)x;
@@ -1224,10 +1337,16 @@ public class PrimFn {
1224 public static BigInteger LFloatIntITBig(double x) {
1337 public static BigInteger LFloatIntITBig(double x) {
1225 return BigInteger.valueOf((long)x);
1338 return BigInteger.valueOf((long)x);
1340+ public static char LFloatIntITChar(double x) {
1228 public static String LIntStr(byte x) {
1344 public static String LIntStr(byte x) {
1229 return Byte.toString(x);
1345 return Byte.toString(x);
1347+ public static String LIntStr(char x) {
1348+ return Character.toString(x);
1231 public static String LIntStr(short x) {
1350 public static String LIntStr(short x) {
1232 return Short.toString(x);
1351 return Short.toString(x);
@@ -1255,6 +1374,9 @@ public class PrimFn {
1255 public static BigInteger LStrIntITBig(String x) {
1374 public static BigInteger LStrIntITBig(String x) {
1256 return new BigInteger(x);
1375 return new BigInteger(x);
1377+ public static char LStrIntITChar(String x) {
1378+ return x.charAt(0);
1259 public static String LFloatStr(double x) {
1381 public static String LFloatStr(double x) {
1260 return Double.toString(x);
1382 return Double.toString(x);
@@ -1266,6 +1388,9 @@ public class PrimFn {
1266 public static char LIntCh(byte x) {
1388 public static char LIntCh(byte x) {
1267 return (char)x;
1389 return (char)x;
1391+ public static char LIntCh(char x) {
1269 public static char LIntCh(short x) {
1394 public static char LIntCh(short x) {
1270 return (char)x;
1395 return (char)x;