@@ -10,7 +10,10 @@ import java.math.BigInteger;
1010public class PrimFn {
1111 public static byte LPlus(byte x, byte y) {
1212 return (byte)(x + y);
13− }
13+ }
14+ public static char LPlus(char x, char y) {
15+ return (char)(x + y);
16+ }
1417 public static short LPlus(short x, short y) {
1518 return (short)(x + y);
1619 }
@@ -57,7 +60,10 @@ public class PrimFn {
5760
5861 public static byte LMinus(byte x, byte y) {
5962 return (byte)(x - y);
60− }
63+ }
64+ public static char LMinus(char x, char y) {
65+ return (char)(x - y);
66+ }
6167 public static short LMinus(short x, short y) {
6268 return (short)(x - y);
6369 }
@@ -104,7 +110,10 @@ public class PrimFn {
104110
105111 public static byte LTimes(byte x, byte y) {
106112 return (byte)(x * y);
107− }
113+ }
114+ public static char LTimes(char x, char y) {
115+ return (char)(x * y);
116+ }
108117 public static short LTimes(short x, short y) {
109118 return (short)(x * y);
110119 }
@@ -151,7 +160,10 @@ public class PrimFn {
151160
152161 public static byte LUDiv(byte x, byte y) {
153162 return (byte)(((short)x) / ((short)y));
154− }
163+ }
164+ public static char LUDiv(char x, char y) {
165+ return (char)(((long)x) / ((long)y));
166+ }
155167 public static short LUDiv(short x, short y) {
156168 return (short)(((int)x) / ((int)y));
157169 }
@@ -192,7 +204,10 @@ public class PrimFn {
192204
193205 public static byte LSDiv(byte x, byte y) {
194206 return (byte)(x / y);
195− }
207+ }
208+ public static char LSDiv(char x, char y) {
209+ return (char)(x / y);
210+ }
196211 public static short LSDiv(short x, short y) {
197212 return (short)(x / y);
198213 }
@@ -240,6 +255,9 @@ public class PrimFn {
240255 public static byte LURem(byte x, byte y) {
241256 return (byte)(((short)x) % ((short)y));
242257 }
258+ public static char LURem(char x, char y) {
259+ return (char)(((long)x) % ((long)y));
260+ }
243261 public static short LURem(short x, short y) {
244262 return (short)(((int)x) % ((int)y));
245263 }
@@ -280,7 +298,10 @@ public class PrimFn {
280298
281299 public static byte LSRem(byte x, byte y) {
282300 return (byte)(x % y);
283− }
301+ }
302+ public static char LSRem(char x, char y) {
303+ return (char)(x % y);
304+ }
284305 public static short LSRem(short x, short y) {
285306 return (short)(x % y);
286307 }
@@ -328,7 +349,10 @@ public class PrimFn {
328349
329350 public static byte LAnd(byte x, byte y) {
330351 return (byte)(x & y);
331− }
352+ }
353+ public static char LAnd(char x, char y) {
354+ return (char)(x & y);
355+ }
332356 public static short LAnd(short x, short y) {
333357 return (short)(x & y);
334358 }
@@ -372,7 +396,10 @@ public class PrimFn {
372396
373397 public static byte LOr(byte x, byte y) {
374398 return (byte)(x | y);
375− }
399+ }
400+ public static char LOr(char x, char y) {
401+ return (char)(x | y);
402+ }
376403 public static short LOr(short x, short y) {
377404 return (short)(x | y);
378405 }
@@ -416,7 +443,10 @@ public class PrimFn {
416443
417444 public static byte LXOr(byte x, byte y) {
418445 return (byte)(x ^ y);
419− }
446+ }
447+ public static char LXOr(char x, char y) {
448+ return (char)(x ^ y);
449+ }
420450 public static short LXOr(short x, short y) {
421451 return (short)(x ^ y);
422452 }
@@ -460,7 +490,10 @@ public class PrimFn {
460490
461491 public static byte LCompl(byte x) {
462492 return (byte)~x;
463− }
493+ }
494+ public static char LCompl(char x) {
495+ return (char)~x;
496+ }
464497 public static short LCompl(short x) {
465498 return (short)(~x);
466499 }
@@ -504,7 +537,10 @@ public class PrimFn {
504537
505538 public static byte LSHL(byte x, byte y) {
506539 return (byte)(x << y);
507− }
540+ }
541+ public static char LSHL(char x, char y) {
542+ return (char)(x << y);
543+ }
508544 public static short LSHL(short x, short y) {
509545 return (short)(x << y);
510546 }
@@ -549,6 +585,9 @@ public class PrimFn {
549585 public static byte LLSHR(byte x, byte y) {
550586 return (byte)(x >>> y);
551587 }
588+ public static char LLSHR(char x, char y) {
589+ return (char)(x >>> y);
590+ }
552591 public static short LLSHR(short x, short y) {
553592 return (short)(x >>> y);
554593 }
@@ -589,7 +628,10 @@ public class PrimFn {
589628
590629 public static byte LASHR(byte x, byte y) {
591630 return (byte)(x >> y);
592− }
631+ }
632+ public static char LASHR(char x, char y) {
633+ return (char)(x >> y);
634+ }
593635 public static short LASHR(short x, short y) {
594636 return (short)(x >> y);
595637 }
@@ -633,7 +675,10 @@ public class PrimFn {
633675
634676 public static int LEq(byte x, byte y) {
635677 return (x == y ? 1 : 0);
636− }
678+ }
679+ public static int LEq(char x, char y) {
680+ return (x == y ? 1 : 0);
681+ }
637682 public static int LEq(short x, short y) {
638683 return (x == y ? 1 : 0);
639684 }
@@ -680,7 +725,10 @@ public class PrimFn {
680725
681726 public static int LLt(byte x, byte y) {
682727 return (x < y ? 1 : 0);
683− }
728+ }
729+ public static int LLt(char x, char y) {
730+ return (x < y ? 1 : 0);
731+ }
684732 public static int LLt(short x, short y) {
685733 return (x < y ? 1 : 0);
686734 }
@@ -727,7 +775,10 @@ public class PrimFn {
727775
728776 public static int LLe(byte x, byte y) {
729777 return (x <= y ? 1 : 0);
730− }
778+ }
779+ public static int LLe(char x, char y) {
780+ return (x <= y ? 1 : 0);
781+ }
731782 public static int LLe(short x, short y) {
732783 return (x <= y ? 1 : 0);
733784 }
@@ -775,6 +826,9 @@ public class PrimFn {
775826 public static int LGt(byte x, byte y) {
776827 return (x > y ? 1 : 0);
777828 }
829+ public static int LGt(char x, char y) {
830+ return (x > y ? 1 : 0);
831+ }
778832 public static int LGt(short x, short y) {
779833 return (x > y ? 1 : 0);
780834 }
@@ -821,7 +875,10 @@ public class PrimFn {
821875
822876 public static int LGe(byte x, byte y) {
823877 return (x >= y ? 1 : 0);
824− }
878+ }
879+ public static int LGe(char x, char y) {
880+ return (x >= y ? 1 : 0);
881+ }
825882 public static int LGe(short x, short y) {
826883 return (x >= y ? 1 : 0);
827884 }
@@ -901,6 +958,19 @@ public class PrimFn {
901958 return res;
902959 }
903960
961+ public static short LSExtIT16(char x) {
962+ return (short)x;
963+ }
964+ public static int LSExtIT32(char x) {
965+ return (int)x;
966+ }
967+ public static long LSExtIT64(char x) {
968+ return (long)x;
969+ }
970+ public static BigInteger LSExtITBig(char x) {
971+ return BigInteger.valueOf(x);
972+ }
973+
904974 public static int LSExtIT32(short x) {
905975 return (int)x;
906976 }
@@ -955,6 +1025,9 @@ public class PrimFn {
9551025 public static BigInteger LZExtITBig(byte x) {
9561026 return BigInteger.valueOf(x < 0 ? x + (2 << 7) : x);
9571027 }
1028+ public static char LZExtITChar(byte x) {
1029+ return (char)(x < 0 ? x + (2 << 7) : x);
1030+ }
9581031 public static short[] LZExtITVec16(byte[] x) {
9591032 short[] res = new short[x.length];
9601033 for (int i = 0; i < res.length; ++i) {
@@ -976,7 +1049,7 @@ public class PrimFn {
9761049 }
9771050 return res;
9781051 }
979−
1052+
9801053 public static int LZExtIT32(short x) {
9811054 return (int)(x < 0 ? x + (2 << 15) : x);
9821055 }
@@ -986,6 +1059,9 @@ public class PrimFn {
9861059 public static BigInteger LZExtITBig(short x) {
9871060 return BigInteger.valueOf(x < 0 ? x + (2 << 15) : x);
9881061 }
1062+ public static char LZExtITChar(short x) {
1063+ return (char)(x < 0 ? x + (2 << 15) : x);
1064+ }
9891065 public static int[] LZExtITVec32(short[] x) {
9901066 int[] res = new int[x.length];
9911067 for (int i = 0; i < res.length; ++i) {
@@ -1007,6 +1083,9 @@ public class PrimFn {
10071083 public static BigInteger LZExtITBig(int x) {
10081084 return BigInteger.valueOf(x < 0 ? ((long)x) + (2 << 31) : x);
10091085 }
1086+ public static char LZExtITChar(int x) {
1087+ return (char)(x < 0 ? ((long)x) + (2 << 31) : x);
1088+ }
10101089 public static long[] LZExtITVec64(int[] x) {
10111090 long[] res = new long[x.length];
10121091 for (int i = 0; i < res.length; ++i) {
@@ -1018,6 +1097,9 @@ public class PrimFn {
10181097 public static BigInteger LZExtITBig(long x) {
10191098 return (x < 0 ? BigInteger.valueOf(x).add(BigInteger.valueOf(2).shiftLeft(61)) : BigInteger.valueOf(x));
10201099 }
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());
1102+ }
10211103
10221104 public static byte LTruncIT8(short x) {
10231105 return (byte)x;
@@ -1029,6 +1111,9 @@ public class PrimFn {
10291111 }
10301112 return res;
10311113 }
1114+ public static char LTruncITChar(short x) {
1115+ return (char)x;
1116+ }
10321117
10331118 public static byte LTruncIT8(int x) {
10341119 return (byte)x;
@@ -1050,6 +1135,9 @@ public class PrimFn {
10501135 }
10511136 return res;
10521137 }
1138+ public static char LTruncITChar(int x) {
1139+ return (char)x;
1140+ }
10531141
10541142 public static byte LTruncIT8(long x) {
10551143 return (byte)x;
@@ -1081,6 +1169,9 @@ public class PrimFn {
10811169 }
10821170 return res;
10831171 }
1172+ public static char LTruncITChar(long x) {
1173+ return (char)x;
1174+ }
10841175
10851176 public static byte LTruncIT8(BigInteger x) {
10861177 return x.byteValue();
@@ -1094,6 +1185,25 @@ public class PrimFn {
10941185 public static long LTruncIT64(BigInteger x) {
10951186 return x.longValue();
10961187 }
1188+ public static char LTruncITChar(BigInteger x) {
1189+ return (char)x.intValue();
1190+ }
1191+
1192+ public static byte LTruncIT8(char x) {
1193+ return (byte)x;
1194+ }
1195+ public static short LTruncIT16(char x) {
1196+ return (short)x;
1197+ }
1198+ public static int LTruncIT32(char x) {
1199+ return (int)x;
1200+ }
1201+ public static long LTruncIT64(char x) {
1202+ return (int)x;
1203+ }
1204+ public static BigInteger LTruncITBig(char x) {
1205+ return BigInteger.valueOf(x);
1206+ }
10971207
10981208
10991209 public static double LFExp(double x) {
@@ -1196,6 +1306,9 @@ public class PrimFn {
11961306 public static double LIntFloat(byte x) {
11971307 return (double)x;
11981308 }
1309+ public static double LIntFloat(char x) {
1310+ return (double)x;
1311+ }
11991312 public static double LIntFloat(short x) {
12001313 return (double)x;
12011314 }
@@ -1224,10 +1337,16 @@ public class PrimFn {
12241337 public static BigInteger LFloatIntITBig(double x) {
12251338 return BigInteger.valueOf((long)x);
12261339 }
1340+ public static char LFloatIntITChar(double x) {
1341+ return (char)x;
1342+ }
12271343
12281344 public static String LIntStr(byte x) {
12291345 return Byte.toString(x);
12301346 }
1347+ public static String LIntStr(char x) {
1348+ return Character.toString(x);
1349+ }
12311350 public static String LIntStr(short x) {
12321351 return Short.toString(x);
12331352 }
@@ -1255,6 +1374,9 @@ public class PrimFn {
12551374 public static BigInteger LStrIntITBig(String x) {
12561375 return new BigInteger(x);
12571376 }
1377+ public static char LStrIntITChar(String x) {
1378+ return x.charAt(0);
1379+ }
12581380
12591381 public static String LFloatStr(double x) {
12601382 return Double.toString(x);
@@ -1266,6 +1388,9 @@ public class PrimFn {
12661388 public static char LIntCh(byte x) {
12671389 return (char)x;
12681390 }
1391+ public static char LIntCh(char x) {
1392+ return x;
1393+ }
12691394 public static char LIntCh(short x) {
12701395 return (char)x;
12711396 }