It's still extremely unfinished, and due to an (already-fixed) bug report it won't work right in the current version, but progress is coming along reasonably well. Below the current output for a 4 block (64 bit) unsigned integer
#define pliFLR(X) round(X)
#define pliTB64(x) (((x) <= 25) ? ascii2text(65 + (x)) : (((x) <= 51) ? ascii2text(71 + (x)) : (((x) <= 61) ? "[(x)-52]" : (((x) == 62) ? "+" : "/"))))
#define pliBYT1(X) ((X) & 0x00FF)
#define pliBYT2(X) (((X) & 0xFF00) >> 8)
#define pliBYT1N(X) (~(X) & 0x00FF)
#define pliBYT2N(X) ((~(X) & 0xFF00) >> 8)
#define pliBYT1S(X) (((X) & 0x00FF) << 8)
#define pliDATA(X) pliBYT1(X)
#define pliBUFR(X) pliBYT2(X)
#define pliADDB(X,Y) (Y) += pliBUFFER(X)
#define pliADDD(X,Y) (Y) += pliDATA(X)
#define pliDATM2(X) (pliDATA(X) << 1)
#define pliBUFM2(X) (((X) & 0xFF00) >> 7)
#define pliADDDTM2(X,Y) (Y) += pliDATA_T2(X)
#define pliADDBFM2(X,Y) (Y) += pliBUFFER_T2(X)
#define pliFLSH(X) (X) &= 0x00FF
pif_LongInt/Unsigned64
var
block_1 = 0
block_2 = 0
block_3 = 0
block_4 = 0
const/Length = 4
mode = OLD_OBJECT | NO_OVERFLOW_EXCEPTION | FIXED_PRECISION | UNSIGNED_MODE
New(...)
if(args.len == 1)
block_1 = args[1]
else if(args.len == 2)
block_1 = args[2]
block_2 = args[1]
else if(args.len == 3)
block_1 = args[3]
block_2 = args[2]
block_3 = args[1]
else if(args.len == 4)
block_1 = args[4]
block_2 = args[3]
block_3 = args[2]
block_4 = args[1]
return src
ToFloat()
return ((block_4 & 0x8000) >> 15) * 9223372036854775800.0 + \
((block_4 & 0x4000) >> 14) * 4611686018427387900.0 + \
((block_4 & 0x2000) >> 13) * 2305843009213694000.0 + \
((block_4 & 0x1000) >> 12) * 1152921504606847000.0 + \
((block_4 & 0x0800) >> 11) * 576460752303423490.0 + \
((block_4 & 0x0400) >> 10) * 288230376151711740.0 + \
((block_4 & 0x0200) >> 9) * 144115188075855870.0 + \
((block_4 & 0x0100) >> 8) * 72057594037927936.0 + \
((block_4 & 0x0080) >> 7) * 36028797018963968.0 + \
((block_4 & 0x0040) >> 6) * 18014398509481984.0 + \
((block_4 & 0x0020) >> 5) * 9007199254740992.0 + \
((block_4 & 0x0010) >> 4) * 4503599627370496.0 + \
((block_4 & 0x0008) >> 3) * 2251799813685248.0 + \
((block_4 & 0x0004) >> 2) * 1125899906842624.0 + \
((block_4 & 0x0002) >> 1) * 562949953421312.0 + \
(block_4 & 0x0001) * 281474976710656.0 + \
((block_3 & 0x8000) >> 15) * 140737488355328.0 + \
((block_3 & 0x4000) >> 14) * 70368744177664.0 + \
((block_3 & 0x2000) >> 13) * 35184372088832.0 + \
((block_3 & 0x1000) >> 12) * 17592186044416.0 + \
((block_3 & 0x0800) >> 11) * 8796093022208.0 + \
((block_3 & 0x0400) >> 10) * 4398046511104.0 + \
((block_3 & 0x0200) >> 9) * 2199023255552.0 + \
((block_3 & 0x0100) >> 8) * 1099511627776.0 + \
((block_3 & 0x0080) >> 7) * 549755813888.0 + \
((block_3 & 0x0040) >> 6) * 274877906944.0 + \
((block_3 & 0x0020) >> 5) * 137438953472.0 + \
((block_3 & 0x0010) >> 4) * 68719476736.0 + \
((block_3 & 0x0008) >> 3) * 34359738368.0 + \
((block_3 & 0x0004) >> 2) * 17179869184.0 + \
((block_3 & 0x0002) >> 1) * 8589934592.0 + \
(block_3 & 0x0001) * 4294967296.0 + \
((block_2 & 0x8000) >> 15) * 2147483648.0 + \
((block_2 & 0x4000) >> 14) * 1073741824.0 + \
((block_2 & 0x2000) >> 13) * 536870912.0 + \
((block_2 & 0x1000) >> 12) * 268435456.0 + \
((block_2 & 0x0800) >> 11) * 134217728.0 + \
((block_2 & 0x0400) >> 10) * 67108864.0 + \
((block_2 & 0x0200) >> 9) * 33554432.0 + \
((block_2 & 0x0100) >> 8) * 16777216.0 + \
((block_2 & 0x0080) >> 7) * 8388608.0 + \
((block_2 & 0x0040) >> 6) * 4194304.0 + \
((block_2 & 0x0020) >> 5) * 2097152.0 + \
((block_2 & 0x0010) >> 4) * 1048576.0 + \
((block_2 & 0x0008) >> 3) * 524288.0 + \
((block_2 & 0x0004) >> 2) * 262144.0 + \
((block_2 & 0x0002) >> 1) * 131072.0 + \
(block_2 & 0x0001) * 65536.0 + \
block_1
_GetBlock(i)
if(!isnum(i))
throw new /pif_Arithmetic/NonIntegerException(__FILE__, __LINE__)
if(i <= 0)
throw new /pif_Arithmetic/NonPositiveIntegerException(__FILE__, __LINE__)
if(i > Length)
throw new /pif_Arithmetic/OutOfBoundsException(__FILE__, __LINE__)
switch(i)
if(1) return block_1
if(2) return block_2
if(3) return block_3
if(4) return block_4
_SetBlock(i, j)
if(!isnum(i) || !isnum(j))
throw new /pif_Arithmetic/NonIntegerException(__FILE__, __LINE__)
if(i <= 0)
throw new /pif_Arithmetic/NonPositiveIntegerException(__FILE__, __LINE__)
if(i > Length)
throw new /pif_Arithmetic/OutOfBoundsException(__FILE__, __LINE__)
switch(i)
if(1) return (block_1 = j)
if(2) return (block_2 = j)
if(3) return (block_3 = j)
if(4) return (block_4 = j)
Add(...)
var
Int_block_1 = 0
Int_block_2 = 0
Int_block_3 = 0
Int_block_4 = 0
pif_LongInt/Unsigned64/Sum
B1 = 0
B2 = 0
if(args.len == 1)
Int_block_1 = args[1]
else if(args.len == 2)
Int_block_1 = args[2]
Int_block_2 = args[1]
else if(args.len == 3)
Int_block_1 = args[3]
Int_block_2 = args[2]
Int_block_3 = args[1]
else if(args.len == 4)
Int_block_1 = args[4]
Int_block_2 = args[3]
Int_block_3 = args[2]
Int_block_4 = args[1]
if(mode & NEW_OBJECT)
Sum = new(src)
else
Sum = src
B1 = pliBYT1(block_1) + pliBYT1(Int_block_1)
B2 = pliBYT2(block_1) + pliBYT2(Int_block_1) + pliBUFR(B1)
Sum._SetBlock(1, pliBYT1(B1) | pliBYT1S(B2))
B1 = pliBYT1(block_2) + pliBYT1(Int_block_2) + pliBUFR(B2)
B2 = pliBYT2(block_2) + pliBYT2(Int_block_2) + pliBUFR(B1)
Sum._SetBlock(2, pliBYT1(B1) | pliBYT1S(B2))
B1 = pliBYT1(block_3) + pliBYT1(Int_block_3) + pliBUFR(B2)
B2 = pliBYT2(block_3) + pliBYT2(Int_block_3) + pliBUFR(B1)
Sum._SetBlock(3, pliBYT1(B1) | pliBYT1S(B2))
B1 = pliBYT1(block_4) + pliBYT1(Int_block_4) + pliBUFR(B2)
B2 = pliBYT2(block_4) + pliBYT2(Int_block_4) + pliBUFR(B1)
Sum._SetBlock(4, pliBYT1(B1) | pliBYT1S(B2))
if( (pliBUFR(B2) != 0) && (mode & OVERFLOW_EXCEPTION) )
throw new /pif_Arithmetic/OverflowException(__FILE__, __LINE__)
return Sum
Add(...)
var
Int_block_1 = 0
Int_block_2 = 0
Int_block_3 = 0
Int_block_4 = 0
pif_LongInt/Unsigned64/Diff
B1 = 0
B2 = 0
if(args.len == 1)
Int_block_1 = args[1]
else if(args.len == 2)
Int_block_1 = args[2]
Int_block_2 = args[1]
else if(args.len == 3)
Int_block_1 = args[3]
Int_block_2 = args[2]
Int_block_3 = args[1]
else if(args.len == 4)
Int_block_1 = args[4]
Int_block_2 = args[3]
Int_block_3 = args[2]
Int_block_4 = args[1]
if(mode & NEW_OBJECT)
Diff = new(src)
else
Diff = src
B1 = pliBYT1(block_1) + pliBYT1N(Int_block_1) + 1
B2 = pliBYT2(block_1) + pliBYT2N(Int_block_1) + pliBUFR(B1)
Sum._SetBlock(1, pliBYT1(B1) | pliBYT1S(B2))
B1 = pliBYT1(block_2) + pliBYT1N(Int_block_2) + pliBUFR(B2)
B2 = pliBYT2(block_2) + pliBYT2N(Int_block_2) + pliBUFR(B1)
Sum._SetBlock(2, pliBYT1(B1) | pliBYT1S(B2))
B1 = pliBYT1(block_3) + pliBYT1N(Int_block_3) + pliBUFR(B2)
B2 = pliBYT2(block_3) + pliBYT2N(Int_block_3) + pliBUFR(B1)
Sum._SetBlock(3, pliBYT1(B1) | pliBYT1S(B2))
B1 = pliBYT1(block_4) + pliBYT1N(Int_block_4) + pliBUFR(B2)
B2 = pliBYT2(block_4) + pliBYT2N(Int_block_4) + pliBUFR(B1)
Sum._SetBlock(4, pliBYT1(B1) | pliBYT1S(B2))
if( (pliBUFR(B2) != 0) && (mode & OVERFLOW_EXCEPTION) )
throw new /pif_Arithmetic/OverflowException(__FILE__, __LINE__)
return Sum
Most of the class shouldn't actually be too bad, but I do see two methods that'll probably end up being annoying: multiplication and division. The former will mostly just be annoyingly-tedious, but the latter will mostly come from me no longer having the copy of The Art of Computer Programming I borrowed to read up on Knuth's Algorithm D. I'm hoping I can glean it from my comments, because otherwise I'll need to find another copy.
Boss cutscenes are coming along! Still a wip, though.