I wanted a tiny scriptable meltdown proof way to run userspace programs and visualize how program execution impacts memory. It helps to explain how things like Actually Portable Executable works. It can show you how the GCC generated code is going about manipulating matrices and more. I didn't feel fully comfortable with Qemu and Bochs because I'm not smart enough to understand them. I wanted something like gVisor but with much stronger levels of assurances. I wanted a single binary that'll run, on all major operating systems with an embedded GPL barrier ZIP filesystem that is tiny enough to transpile to JavaScript and run in browsers too. https://justine.storage.googleapis.com/emulator625.mp4
89 lines
3.7 KiB
SQL
89 lines
3.7 KiB
SQL
M(2, g, "+", Add, x + y, "add")
|
||
M(2, g, "-", Sub, x - y, "sub")
|
||
M(2, g, "*", Mul, x *y, "multiply")
|
||
M(2, f, "/", Div, x / y, "division")
|
||
M(2, i, "%", Rem, x % y, "integer remainder")
|
||
M(2, i, "//", Idiv, x / y, "integer division")
|
||
M(2, g, "**", Expo, powl(x, y), "exponentiation")
|
||
|
||
M(1, i, "~", Not, ~x, "bitwise not")
|
||
M(2, i, "^", Xor, x ^ y, "bitwise xor")
|
||
M(2, i, "|", Or, x | y, "bitwise or")
|
||
M(2, i, "&", And, x &y, "bitwise and")
|
||
M(2, i, ">>", Shr, x >> y, "shift right")
|
||
M(2, i, "<<", Shl, x << y, "shift left")
|
||
|
||
M(1, i, "!", LogicalNot, !x, "logical not")
|
||
M(2, i, "||", LogicalOr, x || y, "logical or")
|
||
M(2, i, "&&", LogicalAnd, x &&y, "logical and")
|
||
|
||
M(2, g, "=", Equal1, x == y && fpclassify(x) == fpclassify(y), "equal to")
|
||
M(2, g, "!=", Notequal, x != y, "not equal to")
|
||
M(2, g, "<", LessThan, x < y, "less than")
|
||
M(2, g, ">", GreaterThan, x > y, "greater than")
|
||
M(2, g, "<=", LessThanEqual, x <= y, "less than or equal to")
|
||
M(2, g, ">=", GreaterThanEqual, x >= y, "greater than or equal to")
|
||
|
||
M(1, i, "gray", Gray, gray(x), "gray coding")
|
||
M(1, i, "ungray", Ungray, ungray(x), "inverse gray coding")
|
||
M(1, i, "popcnt", Popcnt, Popcnt(x), "count bits")
|
||
|
||
M(1, g, "abs", Abs, fabsl(x), "absolute value")
|
||
M(2, g, "min", Min, MIN(x, y), "pops two values and pushes minimum")
|
||
M(2, g, "max", Max, MAX(x, y), "pops two values and pushes maximum")
|
||
|
||
M(2, g, "mod", Euclidean, emodl(x, y), "euclidean remainder")
|
||
M(2, g, "rem", Remainder, remainderl(x, y), "float remainder")
|
||
|
||
M(0, i, "false", False, 0, "0")
|
||
M(0, i, "true", True, 1, "1")
|
||
M(0, i, "intmin", IntMin, INT128_MIN, "native integer minimum")
|
||
M(0, i, "intmax", IntMax, INT128_MAX, "native integer maximum")
|
||
M(0, f, "e", Euler, M_E, "𝑒")
|
||
M(0, f, "pi", Fldpi, fldpi(), "π")
|
||
M(0, f, "epsilon", Epsilon, EPSILON, "ɛ")
|
||
M(0, f, "inf", Inf, INFINITY, "∞")
|
||
M(0, f, "nan", Nan, NAN, "NAN")
|
||
M(0, f, "-0", Negzero, -0., "wut")
|
||
M(0, f, "l2t", Fldl2t, fldl2t(), "log₂10")
|
||
M(0, f, "lg2", Fldlg2, fldlg2(), "log₁₀2")
|
||
M(0, f, "ln2", Fldln2, fldln2(), "logₑ2")
|
||
M(0, f, "l2e", Fldl2e, fldl2e(), "logₑ10")
|
||
|
||
M(1, f, "sqrt", Sqrt, sqrtl(x), "√𝑥")
|
||
M(1, f, "exp", Exp, expl(x), "𝑒ˣ")
|
||
M(1, g, "exp2", Exp2, exp2l(x), "2ˣ")
|
||
M(1, g, "exp10", Exp10, exp10l(x), "10ˣ")
|
||
M(2, g, "ldexp", Ldexp, ldexpl(x, y), "𝑥×2ʸ")
|
||
|
||
M(1, f, "log", Log, logl(x), "logₑ𝑥")
|
||
M(1, g, "log2", Log2, log2l(x), "log₂𝑥")
|
||
M(1, g, "log10", Log10, log10l(x), "log₁₀𝑥")
|
||
|
||
M(1, g, "sin", Sin, sinl(x), "sine")
|
||
M(1, g, "cos", Cos, cosl(x), "cosine")
|
||
M(1, g, "tan", Tan, tanl(x), "tangent")
|
||
M(1, g, "asin", Asin, asinl(x), "arcsine")
|
||
M(1, g, "acos", Acos, acosl(x), "arccosine")
|
||
M(1, g, "atan", Atan, atanl(x), "arctangent")
|
||
M(2, g, "atan2", Atan2, atan2l(x, y), "arctangent of 𝑥/𝑦")
|
||
|
||
M(1, g, "round", Round, roundl(x), "round away from zero")
|
||
M(1, g, "trunc", Trunc, truncl(x), "round towards zero")
|
||
M(1, g, "rint", Rint, rintl(x), "round to even")
|
||
M(1, g, "nearbyint", Nearbyint, nearbyint(x), "round to nearest integer")
|
||
M(1, g, "ceil", Ceil, ceill(x), "smallest integral not less than 𝑥")
|
||
M(1, g, "floor", Floor, floorl(x), "largest integral not greater than 𝑥")
|
||
|
||
M(1, f, "isnan", Isnan, isnan(x), "returns true if 𝑥=NAN")
|
||
M(1, f, "isinf", Isinf, isinf(x), "returns true if 𝑥=INFINITY")
|
||
M(1, f, "signbit", Signbit, signbit(x), "clears all bits but sign bit")
|
||
M(1, f, "isfinite", Isfinite, isfinite(x), "returns true if 𝑥≠INFINITY")
|
||
M(1, f, "isnormal", Isnormal, isnormal(x), "returns true if not denormal")
|
||
M(1, f, "fpclassify", Fpclassify, fpclassify(x),
|
||
"nan=0,inf=1,zero=2,subnorm=3,normal=4")
|
||
|
||
M(0, i, "rand", Rand, rand(), "deterministic random number")
|
||
M(0, i, "rand32", Rand32, rand32(), "32-bit random number")
|
||
M(0, i, "rand64", Rand64, rand64(), "64-bit random number")
|