diff --git a/C/decodeCoreJets.inc b/C/decodeCoreJets.inc new file mode 100644 index 000000000..a38932e81 --- /dev/null +++ b/C/decodeCoreJets.inc @@ -0,0 +1,1037 @@ +/* This file has been automatically generated. */ + +{ + int32_t code; + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = VERIFY; return SIMPLICITY_NO_ERROR; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LOW_1; return SIMPLICITY_NO_ERROR; + case 3: *result = LOW_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LOW_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LOW_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LOW_64; return SIMPLICITY_NO_ERROR; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = HIGH_1; return SIMPLICITY_NO_ERROR; + case 3: *result = HIGH_8; return SIMPLICITY_NO_ERROR; + case 4: *result = HIGH_16; return SIMPLICITY_NO_ERROR; + case 5: *result = HIGH_32; return SIMPLICITY_NO_ERROR; + case 6: *result = HIGH_64; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = COMPLEMENT_1; return SIMPLICITY_NO_ERROR; + case 3: *result = COMPLEMENT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = COMPLEMENT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = COMPLEMENT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = COMPLEMENT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = AND_1; return SIMPLICITY_NO_ERROR; + case 3: *result = AND_8; return SIMPLICITY_NO_ERROR; + case 4: *result = AND_16; return SIMPLICITY_NO_ERROR; + case 5: *result = AND_32; return SIMPLICITY_NO_ERROR; + case 6: *result = AND_64; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = OR_1; return SIMPLICITY_NO_ERROR; + case 3: *result = OR_8; return SIMPLICITY_NO_ERROR; + case 4: *result = OR_16; return SIMPLICITY_NO_ERROR; + case 5: *result = OR_32; return SIMPLICITY_NO_ERROR; + case 6: *result = OR_64; return SIMPLICITY_NO_ERROR; + } + break; + case 7: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = XOR_1; return SIMPLICITY_NO_ERROR; + case 3: *result = XOR_8; return SIMPLICITY_NO_ERROR; + case 4: *result = XOR_16; return SIMPLICITY_NO_ERROR; + case 5: *result = XOR_32; return SIMPLICITY_NO_ERROR; + case 6: *result = XOR_64; return SIMPLICITY_NO_ERROR; + } + break; + case 8: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = MAJ_1; return SIMPLICITY_NO_ERROR; + case 3: *result = MAJ_8; return SIMPLICITY_NO_ERROR; + case 4: *result = MAJ_16; return SIMPLICITY_NO_ERROR; + case 5: *result = MAJ_32; return SIMPLICITY_NO_ERROR; + case 6: *result = MAJ_64; return SIMPLICITY_NO_ERROR; + } + break; + case 9: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = XOR_XOR_1; return SIMPLICITY_NO_ERROR; + case 3: *result = XOR_XOR_8; return SIMPLICITY_NO_ERROR; + case 4: *result = XOR_XOR_16; return SIMPLICITY_NO_ERROR; + case 5: *result = XOR_XOR_32; return SIMPLICITY_NO_ERROR; + case 6: *result = XOR_XOR_64; return SIMPLICITY_NO_ERROR; + } + break; + case 10: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = CH_1; return SIMPLICITY_NO_ERROR; + case 3: *result = CH_8; return SIMPLICITY_NO_ERROR; + case 4: *result = CH_16; return SIMPLICITY_NO_ERROR; + case 5: *result = CH_32; return SIMPLICITY_NO_ERROR; + case 6: *result = CH_64; return SIMPLICITY_NO_ERROR; + } + break; + case 11: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = SOME_1; return SIMPLICITY_NO_ERROR; + case 3: *result = SOME_8; return SIMPLICITY_NO_ERROR; + case 4: *result = SOME_16; return SIMPLICITY_NO_ERROR; + case 5: *result = SOME_32; return SIMPLICITY_NO_ERROR; + case 6: *result = SOME_64; return SIMPLICITY_NO_ERROR; + } + break; + case 12: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = ALL_8; return SIMPLICITY_NO_ERROR; + case 4: *result = ALL_16; return SIMPLICITY_NO_ERROR; + case 5: *result = ALL_32; return SIMPLICITY_NO_ERROR; + case 6: *result = ALL_64; return SIMPLICITY_NO_ERROR; + } + break; + case 13: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = EQ_1; return SIMPLICITY_NO_ERROR; + case 3: *result = EQ_8; return SIMPLICITY_NO_ERROR; + case 4: *result = EQ_16; return SIMPLICITY_NO_ERROR; + case 5: *result = EQ_32; return SIMPLICITY_NO_ERROR; + case 6: *result = EQ_64; return SIMPLICITY_NO_ERROR; + case 8: *result = EQ_256; return SIMPLICITY_NO_ERROR; + } + break; + case 14: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = FULL_LEFT_SHIFT_8_1; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_LEFT_SHIFT_16_1; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_LEFT_SHIFT_32_1; return SIMPLICITY_NO_ERROR; + case 6: *result = FULL_LEFT_SHIFT_64_1; return SIMPLICITY_NO_ERROR; + } + break; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 2: *result = FULL_LEFT_SHIFT_8_2; return SIMPLICITY_NO_ERROR; + case 3: *result = FULL_LEFT_SHIFT_16_2; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_LEFT_SHIFT_32_2; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_LEFT_SHIFT_64_2; return SIMPLICITY_NO_ERROR; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_LEFT_SHIFT_8_4; return SIMPLICITY_NO_ERROR; + case 2: *result = FULL_LEFT_SHIFT_16_4; return SIMPLICITY_NO_ERROR; + case 3: *result = FULL_LEFT_SHIFT_32_4; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_LEFT_SHIFT_64_4; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_LEFT_SHIFT_16_8; return SIMPLICITY_NO_ERROR; + case 2: *result = FULL_LEFT_SHIFT_32_8; return SIMPLICITY_NO_ERROR; + case 3: *result = FULL_LEFT_SHIFT_64_8; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_LEFT_SHIFT_32_16; return SIMPLICITY_NO_ERROR; + case 2: *result = FULL_LEFT_SHIFT_64_16; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_LEFT_SHIFT_64_32; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 15: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = FULL_RIGHT_SHIFT_8_1; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_RIGHT_SHIFT_16_1; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_RIGHT_SHIFT_32_1; return SIMPLICITY_NO_ERROR; + case 6: *result = FULL_RIGHT_SHIFT_64_1; return SIMPLICITY_NO_ERROR; + } + break; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 2: *result = FULL_RIGHT_SHIFT_8_2; return SIMPLICITY_NO_ERROR; + case 3: *result = FULL_RIGHT_SHIFT_16_2; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_RIGHT_SHIFT_32_2; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_RIGHT_SHIFT_64_2; return SIMPLICITY_NO_ERROR; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_RIGHT_SHIFT_8_4; return SIMPLICITY_NO_ERROR; + case 2: *result = FULL_RIGHT_SHIFT_16_4; return SIMPLICITY_NO_ERROR; + case 3: *result = FULL_RIGHT_SHIFT_32_4; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_RIGHT_SHIFT_64_4; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_RIGHT_SHIFT_16_8; return SIMPLICITY_NO_ERROR; + case 2: *result = FULL_RIGHT_SHIFT_32_8; return SIMPLICITY_NO_ERROR; + case 3: *result = FULL_RIGHT_SHIFT_64_8; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_RIGHT_SHIFT_32_16; return SIMPLICITY_NO_ERROR; + case 2: *result = FULL_RIGHT_SHIFT_64_16; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = FULL_RIGHT_SHIFT_64_32; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 16: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LEFTMOST_8_1; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFTMOST_16_1; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFTMOST_32_1; return SIMPLICITY_NO_ERROR; + case 6: *result = LEFTMOST_64_1; return SIMPLICITY_NO_ERROR; + } + break; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 2: *result = LEFTMOST_8_2; return SIMPLICITY_NO_ERROR; + case 3: *result = LEFTMOST_16_2; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFTMOST_32_2; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFTMOST_64_2; return SIMPLICITY_NO_ERROR; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFTMOST_8_4; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFTMOST_16_4; return SIMPLICITY_NO_ERROR; + case 3: *result = LEFTMOST_32_4; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFTMOST_64_4; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFTMOST_16_8; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFTMOST_32_8; return SIMPLICITY_NO_ERROR; + case 3: *result = LEFTMOST_64_8; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFTMOST_32_16; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFTMOST_64_16; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFTMOST_64_32; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 17: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = RIGHTMOST_8_1; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHTMOST_16_1; return SIMPLICITY_NO_ERROR; + case 5: *result = RIGHTMOST_32_1; return SIMPLICITY_NO_ERROR; + case 6: *result = RIGHTMOST_64_1; return SIMPLICITY_NO_ERROR; + } + break; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 2: *result = RIGHTMOST_8_2; return SIMPLICITY_NO_ERROR; + case 3: *result = RIGHTMOST_16_2; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHTMOST_32_2; return SIMPLICITY_NO_ERROR; + case 5: *result = RIGHTMOST_64_2; return SIMPLICITY_NO_ERROR; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHTMOST_8_4; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHTMOST_16_4; return SIMPLICITY_NO_ERROR; + case 3: *result = RIGHTMOST_32_4; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHTMOST_64_4; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHTMOST_16_8; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHTMOST_32_8; return SIMPLICITY_NO_ERROR; + case 3: *result = RIGHTMOST_64_8; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHTMOST_32_16; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHTMOST_64_16; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHTMOST_64_32; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 18: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LEFT_PAD_LOW_1_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFT_PAD_LOW_1_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFT_PAD_LOW_1_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LEFT_PAD_LOW_1_64; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_PAD_LOW_8_16; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFT_PAD_LOW_8_32; return SIMPLICITY_NO_ERROR; + case 3: *result = LEFT_PAD_LOW_8_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_PAD_LOW_16_32; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFT_PAD_LOW_16_64; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_PAD_LOW_32_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 19: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LEFT_PAD_HIGH_1_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFT_PAD_HIGH_1_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFT_PAD_HIGH_1_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LEFT_PAD_HIGH_1_64; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_PAD_HIGH_8_16; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFT_PAD_HIGH_8_32; return SIMPLICITY_NO_ERROR; + case 3: *result = LEFT_PAD_HIGH_8_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_PAD_HIGH_16_32; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFT_PAD_HIGH_16_64; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_PAD_HIGH_32_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 20: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LEFT_EXTEND_1_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFT_EXTEND_1_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFT_EXTEND_1_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LEFT_EXTEND_1_64; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_EXTEND_8_16; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFT_EXTEND_8_32; return SIMPLICITY_NO_ERROR; + case 3: *result = LEFT_EXTEND_8_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_EXTEND_16_32; return SIMPLICITY_NO_ERROR; + case 2: *result = LEFT_EXTEND_16_64; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LEFT_EXTEND_32_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 21: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = RIGHT_PAD_LOW_1_8; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHT_PAD_LOW_1_16; return SIMPLICITY_NO_ERROR; + case 5: *result = RIGHT_PAD_LOW_1_32; return SIMPLICITY_NO_ERROR; + case 6: *result = RIGHT_PAD_LOW_1_64; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_PAD_LOW_8_16; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHT_PAD_LOW_8_32; return SIMPLICITY_NO_ERROR; + case 3: *result = RIGHT_PAD_LOW_8_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_PAD_LOW_16_32; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHT_PAD_LOW_16_64; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_PAD_LOW_32_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 22: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = RIGHT_PAD_HIGH_1_8; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHT_PAD_HIGH_1_16; return SIMPLICITY_NO_ERROR; + case 5: *result = RIGHT_PAD_HIGH_1_32; return SIMPLICITY_NO_ERROR; + case 6: *result = RIGHT_PAD_HIGH_1_64; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_PAD_HIGH_8_16; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHT_PAD_HIGH_8_32; return SIMPLICITY_NO_ERROR; + case 3: *result = RIGHT_PAD_HIGH_8_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_PAD_HIGH_16_32; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHT_PAD_HIGH_16_64; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_PAD_HIGH_32_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 23: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_EXTEND_8_16; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHT_EXTEND_8_32; return SIMPLICITY_NO_ERROR; + case 3: *result = RIGHT_EXTEND_8_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_EXTEND_16_32; return SIMPLICITY_NO_ERROR; + case 2: *result = RIGHT_EXTEND_16_64; return SIMPLICITY_NO_ERROR; + } + break; + case 6: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = RIGHT_EXTEND_32_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 24: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LEFT_SHIFT_WITH_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFT_SHIFT_WITH_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFT_SHIFT_WITH_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LEFT_SHIFT_WITH_64; return SIMPLICITY_NO_ERROR; + } + break; + case 25: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = RIGHT_SHIFT_WITH_8; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHT_SHIFT_WITH_16; return SIMPLICITY_NO_ERROR; + case 5: *result = RIGHT_SHIFT_WITH_32; return SIMPLICITY_NO_ERROR; + case 6: *result = RIGHT_SHIFT_WITH_64; return SIMPLICITY_NO_ERROR; + } + break; + case 26: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LEFT_SHIFT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFT_SHIFT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFT_SHIFT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LEFT_SHIFT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 27: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = RIGHT_SHIFT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHT_SHIFT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = RIGHT_SHIFT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = RIGHT_SHIFT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 28: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LEFT_ROTATE_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LEFT_ROTATE_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LEFT_ROTATE_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LEFT_ROTATE_64; return SIMPLICITY_NO_ERROR; + } + break; + case 29: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = RIGHT_ROTATE_8; return SIMPLICITY_NO_ERROR; + case 4: *result = RIGHT_ROTATE_16; return SIMPLICITY_NO_ERROR; + case 5: *result = RIGHT_ROTATE_32; return SIMPLICITY_NO_ERROR; + case 6: *result = RIGHT_ROTATE_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = ONE_8; return SIMPLICITY_NO_ERROR; + case 4: *result = ONE_16; return SIMPLICITY_NO_ERROR; + case 5: *result = ONE_32; return SIMPLICITY_NO_ERROR; + case 6: *result = ONE_64; return SIMPLICITY_NO_ERROR; + } + break; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = FULL_ADD_8; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_ADD_16; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_ADD_32; return SIMPLICITY_NO_ERROR; + case 6: *result = FULL_ADD_64; return SIMPLICITY_NO_ERROR; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = ADD_8; return SIMPLICITY_NO_ERROR; + case 4: *result = ADD_16; return SIMPLICITY_NO_ERROR; + case 5: *result = ADD_32; return SIMPLICITY_NO_ERROR; + case 6: *result = ADD_64; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = FULL_INCREMENT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_INCREMENT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_INCREMENT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = FULL_INCREMENT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = INCREMENT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = INCREMENT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = INCREMENT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = INCREMENT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 7: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = FULL_SUBTRACT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_SUBTRACT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_SUBTRACT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = FULL_SUBTRACT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 8: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = SUBTRACT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = SUBTRACT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = SUBTRACT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = SUBTRACT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 9: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = NEGATE_8; return SIMPLICITY_NO_ERROR; + case 4: *result = NEGATE_16; return SIMPLICITY_NO_ERROR; + case 5: *result = NEGATE_32; return SIMPLICITY_NO_ERROR; + case 6: *result = NEGATE_64; return SIMPLICITY_NO_ERROR; + } + break; + case 10: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = FULL_DECREMENT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_DECREMENT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_DECREMENT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = FULL_DECREMENT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 11: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = DECREMENT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = DECREMENT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = DECREMENT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = DECREMENT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 12: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = FULL_MULTIPLY_8; return SIMPLICITY_NO_ERROR; + case 4: *result = FULL_MULTIPLY_16; return SIMPLICITY_NO_ERROR; + case 5: *result = FULL_MULTIPLY_32; return SIMPLICITY_NO_ERROR; + case 6: *result = FULL_MULTIPLY_64; return SIMPLICITY_NO_ERROR; + } + break; + case 13: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = MULTIPLY_8; return SIMPLICITY_NO_ERROR; + case 4: *result = MULTIPLY_16; return SIMPLICITY_NO_ERROR; + case 5: *result = MULTIPLY_32; return SIMPLICITY_NO_ERROR; + case 6: *result = MULTIPLY_64; return SIMPLICITY_NO_ERROR; + } + break; + case 14: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = IS_ZERO_8; return SIMPLICITY_NO_ERROR; + case 4: *result = IS_ZERO_16; return SIMPLICITY_NO_ERROR; + case 5: *result = IS_ZERO_32; return SIMPLICITY_NO_ERROR; + case 6: *result = IS_ZERO_64; return SIMPLICITY_NO_ERROR; + } + break; + case 15: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = IS_ONE_8; return SIMPLICITY_NO_ERROR; + case 4: *result = IS_ONE_16; return SIMPLICITY_NO_ERROR; + case 5: *result = IS_ONE_32; return SIMPLICITY_NO_ERROR; + case 6: *result = IS_ONE_64; return SIMPLICITY_NO_ERROR; + } + break; + case 16: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LE_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LE_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LE_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LE_64; return SIMPLICITY_NO_ERROR; + } + break; + case 17: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = LT_8; return SIMPLICITY_NO_ERROR; + case 4: *result = LT_16; return SIMPLICITY_NO_ERROR; + case 5: *result = LT_32; return SIMPLICITY_NO_ERROR; + case 6: *result = LT_64; return SIMPLICITY_NO_ERROR; + } + break; + case 18: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = MIN_8; return SIMPLICITY_NO_ERROR; + case 4: *result = MIN_16; return SIMPLICITY_NO_ERROR; + case 5: *result = MIN_32; return SIMPLICITY_NO_ERROR; + case 6: *result = MIN_64; return SIMPLICITY_NO_ERROR; + } + break; + case 19: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = MAX_8; return SIMPLICITY_NO_ERROR; + case 4: *result = MAX_16; return SIMPLICITY_NO_ERROR; + case 5: *result = MAX_32; return SIMPLICITY_NO_ERROR; + case 6: *result = MAX_64; return SIMPLICITY_NO_ERROR; + } + break; + case 20: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = MEDIAN_8; return SIMPLICITY_NO_ERROR; + case 4: *result = MEDIAN_16; return SIMPLICITY_NO_ERROR; + case 5: *result = MEDIAN_32; return SIMPLICITY_NO_ERROR; + case 6: *result = MEDIAN_64; return SIMPLICITY_NO_ERROR; + } + break; + case 21: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 6: *result = DIV_MOD_128_64; return SIMPLICITY_NO_ERROR; + } + break; + case 22: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = DIV_MOD_8; return SIMPLICITY_NO_ERROR; + case 4: *result = DIV_MOD_16; return SIMPLICITY_NO_ERROR; + case 5: *result = DIV_MOD_32; return SIMPLICITY_NO_ERROR; + case 6: *result = DIV_MOD_64; return SIMPLICITY_NO_ERROR; + } + break; + case 23: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = DIVIDE_8; return SIMPLICITY_NO_ERROR; + case 4: *result = DIVIDE_16; return SIMPLICITY_NO_ERROR; + case 5: *result = DIVIDE_32; return SIMPLICITY_NO_ERROR; + case 6: *result = DIVIDE_64; return SIMPLICITY_NO_ERROR; + } + break; + case 24: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = MODULO_8; return SIMPLICITY_NO_ERROR; + case 4: *result = MODULO_16; return SIMPLICITY_NO_ERROR; + case 5: *result = MODULO_32; return SIMPLICITY_NO_ERROR; + case 6: *result = MODULO_64; return SIMPLICITY_NO_ERROR; + } + break; + case 25: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 3: *result = DIVIDES_8; return SIMPLICITY_NO_ERROR; + case 4: *result = DIVIDES_16; return SIMPLICITY_NO_ERROR; + case 5: *result = DIVIDES_32; return SIMPLICITY_NO_ERROR; + case 6: *result = DIVIDES_64; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = SHA_256_BLOCK; return SIMPLICITY_NO_ERROR; + case 2: *result = SHA_256_IV; return SIMPLICITY_NO_ERROR; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = SHA_256_CTX_8_ADD_1; return SIMPLICITY_NO_ERROR; + case 2: *result = SHA_256_CTX_8_ADD_2; return SIMPLICITY_NO_ERROR; + case 3: *result = SHA_256_CTX_8_ADD_4; return SIMPLICITY_NO_ERROR; + case 4: *result = SHA_256_CTX_8_ADD_8; return SIMPLICITY_NO_ERROR; + case 5: *result = SHA_256_CTX_8_ADD_16; return SIMPLICITY_NO_ERROR; + case 6: *result = SHA_256_CTX_8_ADD_32; return SIMPLICITY_NO_ERROR; + case 7: *result = SHA_256_CTX_8_ADD_64; return SIMPLICITY_NO_ERROR; + case 8: *result = SHA_256_CTX_8_ADD_128; return SIMPLICITY_NO_ERROR; + case 9: *result = SHA_256_CTX_8_ADD_256; return SIMPLICITY_NO_ERROR; + case 10: *result = SHA_256_CTX_8_ADD_512; return SIMPLICITY_NO_ERROR; + } + break; + case 4: *result = SHA_256_CTX_8_ADD_BUFFER_511; return SIMPLICITY_NO_ERROR; + case 5: *result = SHA_256_CTX_8_FINALIZE; return SIMPLICITY_NO_ERROR; + case 6: *result = SHA_256_CTX_8_INIT; return SIMPLICITY_NO_ERROR; + } + break; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = POINT_VERIFY_1; return SIMPLICITY_NO_ERROR; + } + break; + case 2: *result = DECOMPRESS; return SIMPLICITY_NO_ERROR; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LINEAR_VERIFY_1; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = LINEAR_COMBINATION_1; return SIMPLICITY_NO_ERROR; + } + break; + case 5: *result = SCALE; return SIMPLICITY_NO_ERROR; + case 6: *result = GENERATE; return SIMPLICITY_NO_ERROR; + case 7: *result = GEJ_INFINITY; return SIMPLICITY_NO_ERROR; + case 8: *result = GEJ_NORMALIZE; return SIMPLICITY_NO_ERROR; + case 9: *result = GEJ_NEGATE; return SIMPLICITY_NO_ERROR; + case 10: *result = GE_NEGATE; return SIMPLICITY_NO_ERROR; + case 11: *result = GEJ_DOUBLE; return SIMPLICITY_NO_ERROR; + case 12: *result = GEJ_ADD; return SIMPLICITY_NO_ERROR; + case 13: *result = GEJ_GE_ADD_EX; return SIMPLICITY_NO_ERROR; + case 14: *result = GEJ_GE_ADD; return SIMPLICITY_NO_ERROR; + case 15: *result = GEJ_RESCALE; return SIMPLICITY_NO_ERROR; + case 16: *result = GEJ_IS_INFINITY; return SIMPLICITY_NO_ERROR; + case 17: *result = GEJ_EQUIV; return SIMPLICITY_NO_ERROR; + case 18: *result = GEJ_GE_EQUIV; return SIMPLICITY_NO_ERROR; + case 19: *result = GEJ_X_EQUIV; return SIMPLICITY_NO_ERROR; + case 20: *result = GEJ_Y_IS_ODD; return SIMPLICITY_NO_ERROR; + case 21: *result = GEJ_IS_ON_CURVE; return SIMPLICITY_NO_ERROR; + case 22: *result = GE_IS_ON_CURVE; return SIMPLICITY_NO_ERROR; + case 23: *result = SCALAR_NORMALIZE; return SIMPLICITY_NO_ERROR; + case 24: *result = SCALAR_NEGATE; return SIMPLICITY_NO_ERROR; + case 25: *result = SCALAR_ADD; return SIMPLICITY_NO_ERROR; + case 26: *result = SCALAR_SQUARE; return SIMPLICITY_NO_ERROR; + case 27: *result = SCALAR_MULTIPLY; return SIMPLICITY_NO_ERROR; + case 28: *result = SCALAR_MULTIPLY_LAMBDA; return SIMPLICITY_NO_ERROR; + case 29: *result = SCALAR_INVERT; return SIMPLICITY_NO_ERROR; + case 30: *result = SCALAR_IS_ZERO; return SIMPLICITY_NO_ERROR; + case 35: *result = FE_NORMALIZE; return SIMPLICITY_NO_ERROR; + case 36: *result = FE_NEGATE; return SIMPLICITY_NO_ERROR; + case 37: *result = FE_ADD; return SIMPLICITY_NO_ERROR; + case 38: *result = FE_SQUARE; return SIMPLICITY_NO_ERROR; + case 39: *result = FE_MULTIPLY; return SIMPLICITY_NO_ERROR; + case 40: *result = FE_MULTIPLY_BETA; return SIMPLICITY_NO_ERROR; + case 41: *result = FE_INVERT; return SIMPLICITY_NO_ERROR; + case 42: *result = FE_SQUARE_ROOT; return SIMPLICITY_NO_ERROR; + case 43: *result = FE_IS_ZERO; return SIMPLICITY_NO_ERROR; + case 44: *result = FE_IS_ODD; return SIMPLICITY_NO_ERROR; + case 46: *result = HASH_TO_CURVE; return SIMPLICITY_NO_ERROR; + case 47: *result = SWU; return SIMPLICITY_NO_ERROR; + } + break; + case 5: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = CHECK_SIG_VERIFY; return SIMPLICITY_NO_ERROR; + case 2: *result = BIP_0340_VERIFY; return SIMPLICITY_NO_ERROR; + } + break; + case 7: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = PARSE_LOCK; return SIMPLICITY_NO_ERROR; + case 2: *result = PARSE_SEQUENCE; return SIMPLICITY_NO_ERROR; + case 3: *result = TAPDATA_INIT; return SIMPLICITY_NO_ERROR; + } + break; + } +} \ No newline at end of file diff --git a/C/primitive/elements/decodeElementsJets.inc b/C/primitive/elements/decodeElementsJets.inc new file mode 100644 index 000000000..b2478e45a --- /dev/null +++ b/C/primitive/elements/decodeElementsJets.inc @@ -0,0 +1,136 @@ +/* This file has been automatically generated. */ + +{ + int32_t code; + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = SIG_ALL_HASH; return SIMPLICITY_NO_ERROR; + case 2: *result = TX_HASH; return SIMPLICITY_NO_ERROR; + case 3: *result = TAP_ENV_HASH; return SIMPLICITY_NO_ERROR; + case 4: *result = OUTPUTS_HASH; return SIMPLICITY_NO_ERROR; + case 5: *result = INPUTS_HASH; return SIMPLICITY_NO_ERROR; + case 6: *result = ISSUANCES_HASH; return SIMPLICITY_NO_ERROR; + case 7: *result = INPUT_UTXOS_HASH; return SIMPLICITY_NO_ERROR; + case 8: *result = OUTPUT_HASH; return SIMPLICITY_NO_ERROR; + case 9: *result = OUTPUT_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; + case 10: *result = OUTPUT_SCRIPTS_HASH; return SIMPLICITY_NO_ERROR; + case 11: *result = OUTPUT_NONCES_HASH; return SIMPLICITY_NO_ERROR; + case 12: *result = OUTPUT_RANGE_PROOFS_HASH; return SIMPLICITY_NO_ERROR; + case 13: *result = OUTPUT_SURJECTION_PROOFS_HASH; return SIMPLICITY_NO_ERROR; + case 14: *result = INPUT_HASH; return SIMPLICITY_NO_ERROR; + case 15: *result = INPUT_OUTPOINTS_HASH; return SIMPLICITY_NO_ERROR; + case 16: *result = INPUT_SEQUENCES_HASH; return SIMPLICITY_NO_ERROR; + case 17: *result = INPUT_ANNEXES_HASH; return SIMPLICITY_NO_ERROR; + case 18: *result = INPUT_SCRIPT_SIGS_HASH; return SIMPLICITY_NO_ERROR; + case 19: *result = ISSUANCE_HASH; return SIMPLICITY_NO_ERROR; + case 20: *result = ISSUANCE_ASSET_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; + case 21: *result = ISSUANCE_TOKEN_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; + case 22: *result = ISSUANCE_RANGE_PROOFS_HASH; return SIMPLICITY_NO_ERROR; + case 23: *result = ISSUANCE_BLINDING_ENTROPY_HASH; return SIMPLICITY_NO_ERROR; + case 24: *result = INPUT_UTXO_HASH; return SIMPLICITY_NO_ERROR; + case 25: *result = INPUT_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; + case 26: *result = INPUT_SCRIPTS_HASH; return SIMPLICITY_NO_ERROR; + case 27: *result = TAPLEAF_HASH; return SIMPLICITY_NO_ERROR; + case 28: *result = TAPPATH_HASH; return SIMPLICITY_NO_ERROR; + case 29: *result = OUTPOINT_HASH; return SIMPLICITY_NO_ERROR; + case 30: *result = ASSET_AMOUNT_HASH; return SIMPLICITY_NO_ERROR; + case 31: *result = NONCE_HASH; return SIMPLICITY_NO_ERROR; + case 32: *result = ANNEX_HASH; return SIMPLICITY_NO_ERROR; + case 33: *result = BUILD_TAPLEAF_SIMPLICITY; return SIMPLICITY_NO_ERROR; + case 34: *result = BUILD_TAPBRANCH; return SIMPLICITY_NO_ERROR; + case 35: *result = BUILD_TAPTWEAK; return SIMPLICITY_NO_ERROR; + } + break; + case 2: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = CHECK_LOCK_HEIGHT; return SIMPLICITY_NO_ERROR; + case 2: *result = CHECK_LOCK_TIME; return SIMPLICITY_NO_ERROR; + case 3: *result = CHECK_LOCK_DISTANCE; return SIMPLICITY_NO_ERROR; + case 4: *result = CHECK_LOCK_DURATION; return SIMPLICITY_NO_ERROR; + case 5: *result = TX_LOCK_HEIGHT; return SIMPLICITY_NO_ERROR; + case 6: *result = TX_LOCK_TIME; return SIMPLICITY_NO_ERROR; + case 7: *result = TX_LOCK_DISTANCE; return SIMPLICITY_NO_ERROR; + case 8: *result = TX_LOCK_DURATION; return SIMPLICITY_NO_ERROR; + case 9: *result = TX_IS_FINAL; return SIMPLICITY_NO_ERROR; + } + break; + case 3: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = ISSUANCE; return SIMPLICITY_NO_ERROR; + case 2: *result = ISSUANCE_ASSET; return SIMPLICITY_NO_ERROR; + case 3: *result = ISSUANCE_TOKEN; return SIMPLICITY_NO_ERROR; + case 4: *result = ISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; + case 5: *result = CALCULATE_ISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; + case 6: *result = CALCULATE_ASSET; return SIMPLICITY_NO_ERROR; + case 7: *result = CALCULATE_EXPLICIT_TOKEN; return SIMPLICITY_NO_ERROR; + case 8: *result = CALCULATE_CONFIDENTIAL_TOKEN; return SIMPLICITY_NO_ERROR; + case 9: *result = LBTC_ASSET; return SIMPLICITY_NO_ERROR; + } + break; + case 4: + code = simplicity_decodeUptoMaxInt(stream); + if (code < 0) return (simplicity_err)code; + switch (code) { + case 1: *result = SCRIPT_CMR; return SIMPLICITY_NO_ERROR; + case 2: *result = INTERNAL_KEY; return SIMPLICITY_NO_ERROR; + case 3: *result = CURRENT_INDEX; return SIMPLICITY_NO_ERROR; + case 4: *result = NUM_INPUTS; return SIMPLICITY_NO_ERROR; + case 5: *result = NUM_OUTPUTS; return SIMPLICITY_NO_ERROR; + case 6: *result = LOCK_TIME; return SIMPLICITY_NO_ERROR; + case 7: *result = OUTPUT_ASSET; return SIMPLICITY_NO_ERROR; + case 8: *result = OUTPUT_AMOUNT; return SIMPLICITY_NO_ERROR; + case 9: *result = OUTPUT_NONCE; return SIMPLICITY_NO_ERROR; + case 10: *result = OUTPUT_SCRIPT_HASH; return SIMPLICITY_NO_ERROR; + case 11: *result = OUTPUT_NULL_DATUM; return SIMPLICITY_NO_ERROR; + case 12: *result = OUTPUT_IS_FEE; return SIMPLICITY_NO_ERROR; + case 13: *result = OUTPUT_SURJECTION_PROOF; return SIMPLICITY_NO_ERROR; + case 14: *result = OUTPUT_RANGE_PROOF; return SIMPLICITY_NO_ERROR; + case 15: *result = TOTAL_FEE; return SIMPLICITY_NO_ERROR; + case 16: *result = CURRENT_PEGIN; return SIMPLICITY_NO_ERROR; + case 17: *result = CURRENT_PREV_OUTPOINT; return SIMPLICITY_NO_ERROR; + case 18: *result = CURRENT_ASSET; return SIMPLICITY_NO_ERROR; + case 19: *result = CURRENT_AMOUNT; return SIMPLICITY_NO_ERROR; + case 20: *result = CURRENT_SCRIPT_HASH; return SIMPLICITY_NO_ERROR; + case 21: *result = CURRENT_SEQUENCE; return SIMPLICITY_NO_ERROR; + case 22: *result = CURRENT_ANNEX_HASH; return SIMPLICITY_NO_ERROR; + case 23: *result = CURRENT_SCRIPT_SIG_HASH; return SIMPLICITY_NO_ERROR; + case 24: *result = CURRENT_REISSUANCE_BLINDING; return SIMPLICITY_NO_ERROR; + case 25: *result = CURRENT_NEW_ISSUANCE_CONTRACT; return SIMPLICITY_NO_ERROR; + case 26: *result = CURRENT_REISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; + case 27: *result = CURRENT_ISSUANCE_ASSET_AMOUNT; return SIMPLICITY_NO_ERROR; + case 28: *result = CURRENT_ISSUANCE_TOKEN_AMOUNT; return SIMPLICITY_NO_ERROR; + case 29: *result = CURRENT_ISSUANCE_ASSET_PROOF; return SIMPLICITY_NO_ERROR; + case 30: *result = CURRENT_ISSUANCE_TOKEN_PROOF; return SIMPLICITY_NO_ERROR; + case 31: *result = INPUT_PEGIN; return SIMPLICITY_NO_ERROR; + case 32: *result = INPUT_PREV_OUTPOINT; return SIMPLICITY_NO_ERROR; + case 33: *result = INPUT_ASSET; return SIMPLICITY_NO_ERROR; + case 34: *result = INPUT_AMOUNT; return SIMPLICITY_NO_ERROR; + case 35: *result = INPUT_SCRIPT_HASH; return SIMPLICITY_NO_ERROR; + case 36: *result = INPUT_SEQUENCE; return SIMPLICITY_NO_ERROR; + case 37: *result = INPUT_ANNEX_HASH; return SIMPLICITY_NO_ERROR; + case 38: *result = INPUT_SCRIPT_SIG_HASH; return SIMPLICITY_NO_ERROR; + case 39: *result = REISSUANCE_BLINDING; return SIMPLICITY_NO_ERROR; + case 40: *result = NEW_ISSUANCE_CONTRACT; return SIMPLICITY_NO_ERROR; + case 41: *result = REISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; + case 42: *result = ISSUANCE_ASSET_AMOUNT; return SIMPLICITY_NO_ERROR; + case 43: *result = ISSUANCE_TOKEN_AMOUNT; return SIMPLICITY_NO_ERROR; + case 44: *result = ISSUANCE_ASSET_PROOF; return SIMPLICITY_NO_ERROR; + case 45: *result = ISSUANCE_TOKEN_PROOF; return SIMPLICITY_NO_ERROR; + case 46: *result = TAPLEAF_VERSION; return SIMPLICITY_NO_ERROR; + case 47: *result = TAPPATH; return SIMPLICITY_NO_ERROR; + case 48: *result = VERSION; return SIMPLICITY_NO_ERROR; + case 49: *result = GENESIS_BLOCK_HASH; return SIMPLICITY_NO_ERROR; + case 50: *result = TRANSACTION_ID; return SIMPLICITY_NO_ERROR; + } + break; + } +} \ No newline at end of file diff --git a/C/primitive/elements/primitive.c b/C/primitive/elements/primitive.c index f14c23196..da08b9209 100644 --- a/C/primitive/elements/primitive.c +++ b/C/primitive/elements/primitive.c @@ -71,1104 +71,11 @@ static simplicity_err decodePrimitive(jetName* result, bitstream* stream) { if (bit < 0) return (simplicity_err)bit; if (!bit) { /* Core jets */ - int32_t code = simplicity_decodeUptoMaxInt(stream); - int32_t code2; - if (code < 0) return (simplicity_err)code; - - switch (code) { - case 1: /* Word jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: /* Verify */ - *result = VERIFY; return SIMPLICITY_NO_ERROR; - case 2: /* Low */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = LOW_1; return SIMPLICITY_NO_ERROR; - case 3: *result = LOW_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LOW_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LOW_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LOW_64; return SIMPLICITY_NO_ERROR; - } - break; - case 3: /* High */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = HIGH_1; return SIMPLICITY_NO_ERROR; - case 3: *result = HIGH_8; return SIMPLICITY_NO_ERROR; - case 4: *result = HIGH_16; return SIMPLICITY_NO_ERROR; - case 5: *result = HIGH_32; return SIMPLICITY_NO_ERROR; - case 6: *result = HIGH_64; return SIMPLICITY_NO_ERROR; - } - break; - case 4: /* Complement */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = COMPLEMENT_1; return SIMPLICITY_NO_ERROR; - case 3: *result = COMPLEMENT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = COMPLEMENT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = COMPLEMENT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = COMPLEMENT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: /* And */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = AND_1; return SIMPLICITY_NO_ERROR; - case 3: *result = AND_8; return SIMPLICITY_NO_ERROR; - case 4: *result = AND_16; return SIMPLICITY_NO_ERROR; - case 5: *result = AND_32; return SIMPLICITY_NO_ERROR; - case 6: *result = AND_64; return SIMPLICITY_NO_ERROR; - } - break; - case 6: /* Or */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = OR_1; return SIMPLICITY_NO_ERROR; - case 3: *result = OR_8; return SIMPLICITY_NO_ERROR; - case 4: *result = OR_16; return SIMPLICITY_NO_ERROR; - case 5: *result = OR_32; return SIMPLICITY_NO_ERROR; - case 6: *result = OR_64; return SIMPLICITY_NO_ERROR; - } - break; - case 7: /* Xor */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = XOR_1; return SIMPLICITY_NO_ERROR; - case 3: *result = XOR_8; return SIMPLICITY_NO_ERROR; - case 4: *result = XOR_16; return SIMPLICITY_NO_ERROR; - case 5: *result = XOR_32; return SIMPLICITY_NO_ERROR; - case 6: *result = XOR_64; return SIMPLICITY_NO_ERROR; - } - break; - case 8: /* Maj */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = MAJ_1; return SIMPLICITY_NO_ERROR; - case 3: *result = MAJ_8; return SIMPLICITY_NO_ERROR; - case 4: *result = MAJ_16; return SIMPLICITY_NO_ERROR; - case 5: *result = MAJ_32; return SIMPLICITY_NO_ERROR; - case 6: *result = MAJ_64; return SIMPLICITY_NO_ERROR; - } - break; - case 9: /* Xor_Xor */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = XOR_XOR_1; return SIMPLICITY_NO_ERROR; - case 3: *result = XOR_XOR_8; return SIMPLICITY_NO_ERROR; - case 4: *result = XOR_XOR_16; return SIMPLICITY_NO_ERROR; - case 5: *result = XOR_XOR_32; return SIMPLICITY_NO_ERROR; - case 6: *result = XOR_XOR_64; return SIMPLICITY_NO_ERROR; - } - break; - case 10: /* Ch */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = CH_1; return SIMPLICITY_NO_ERROR; - case 3: *result = CH_8; return SIMPLICITY_NO_ERROR; - case 4: *result = CH_16; return SIMPLICITY_NO_ERROR; - case 5: *result = CH_32; return SIMPLICITY_NO_ERROR; - case 6: *result = CH_64; return SIMPLICITY_NO_ERROR; - } - break; - case 11: /* Some */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = SOME_1; return SIMPLICITY_NO_ERROR; - case 3: *result = SOME_8; return SIMPLICITY_NO_ERROR; - case 4: *result = SOME_16; return SIMPLICITY_NO_ERROR; - case 5: *result = SOME_32; return SIMPLICITY_NO_ERROR; - case 6: *result = SOME_64; return SIMPLICITY_NO_ERROR; - } - break; - case 12: /* All */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = ALL_8; return SIMPLICITY_NO_ERROR; - case 4: *result = ALL_16; return SIMPLICITY_NO_ERROR; - case 5: *result = ALL_32; return SIMPLICITY_NO_ERROR; - case 6: *result = ALL_64; return SIMPLICITY_NO_ERROR; - } - break; - case 13: /* Eq */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = EQ_1; return SIMPLICITY_NO_ERROR; - case 3: *result = EQ_8; return SIMPLICITY_NO_ERROR; - case 4: *result = EQ_16; return SIMPLICITY_NO_ERROR; - case 5: *result = EQ_32; return SIMPLICITY_NO_ERROR; - case 6: *result = EQ_64; return SIMPLICITY_NO_ERROR; - case 8: *result = EQ_256; return SIMPLICITY_NO_ERROR; - } - break; - case 14: /* FullLeftShift */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = FULL_LEFT_SHIFT_8_1; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_LEFT_SHIFT_16_1; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_LEFT_SHIFT_32_1; return SIMPLICITY_NO_ERROR; - case 6: *result = FULL_LEFT_SHIFT_64_1; return SIMPLICITY_NO_ERROR; - } - break; - case 2: - switch (code2) { - case 2: *result = FULL_LEFT_SHIFT_8_2; return SIMPLICITY_NO_ERROR; - case 3: *result = FULL_LEFT_SHIFT_16_2; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_LEFT_SHIFT_32_2; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_LEFT_SHIFT_64_2; return SIMPLICITY_NO_ERROR; - } - break; - case 3: - switch (code2) { - case 1: *result = FULL_LEFT_SHIFT_8_4; return SIMPLICITY_NO_ERROR; - case 2: *result = FULL_LEFT_SHIFT_16_4; return SIMPLICITY_NO_ERROR; - case 3: *result = FULL_LEFT_SHIFT_32_4; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_LEFT_SHIFT_64_4; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = FULL_LEFT_SHIFT_16_8; return SIMPLICITY_NO_ERROR; - case 2: *result = FULL_LEFT_SHIFT_32_8; return SIMPLICITY_NO_ERROR; - case 3: *result = FULL_LEFT_SHIFT_64_8; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = FULL_LEFT_SHIFT_32_16; return SIMPLICITY_NO_ERROR; - case 2: *result = FULL_LEFT_SHIFT_64_16; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = FULL_LEFT_SHIFT_64_32; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 15: /* FullRightShift */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = FULL_RIGHT_SHIFT_8_1; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_RIGHT_SHIFT_16_1; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_RIGHT_SHIFT_32_1; return SIMPLICITY_NO_ERROR; - case 6: *result = FULL_RIGHT_SHIFT_64_1; return SIMPLICITY_NO_ERROR; - } - break; - case 2: - switch (code2) { - case 2: *result = FULL_RIGHT_SHIFT_8_2; return SIMPLICITY_NO_ERROR; - case 3: *result = FULL_RIGHT_SHIFT_16_2; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_RIGHT_SHIFT_32_2; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_RIGHT_SHIFT_64_2; return SIMPLICITY_NO_ERROR; - } - break; - case 3: - switch (code2) { - case 1: *result = FULL_RIGHT_SHIFT_8_4; return SIMPLICITY_NO_ERROR; - case 2: *result = FULL_RIGHT_SHIFT_16_4; return SIMPLICITY_NO_ERROR; - case 3: *result = FULL_RIGHT_SHIFT_32_4; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_RIGHT_SHIFT_64_4; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = FULL_RIGHT_SHIFT_16_8; return SIMPLICITY_NO_ERROR; - case 2: *result = FULL_RIGHT_SHIFT_32_8; return SIMPLICITY_NO_ERROR; - case 3: *result = FULL_RIGHT_SHIFT_64_8; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = FULL_RIGHT_SHIFT_32_16; return SIMPLICITY_NO_ERROR; - case 2: *result = FULL_RIGHT_SHIFT_64_16; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = FULL_RIGHT_SHIFT_64_32; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 16: /* Leftmost */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = LEFTMOST_8_1; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFTMOST_16_1; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFTMOST_32_1; return SIMPLICITY_NO_ERROR; - case 6: *result = LEFTMOST_64_1; return SIMPLICITY_NO_ERROR; - } - break; - case 2: - switch (code2) { - case 2: *result = LEFTMOST_8_2; return SIMPLICITY_NO_ERROR; - case 3: *result = LEFTMOST_16_2; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFTMOST_32_2; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFTMOST_64_2; return SIMPLICITY_NO_ERROR; - } - break; - case 3: - switch (code2) { - case 1: *result = LEFTMOST_8_4; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFTMOST_16_4; return SIMPLICITY_NO_ERROR; - case 3: *result = LEFTMOST_32_4; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFTMOST_64_4; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = LEFTMOST_16_8; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFTMOST_32_8; return SIMPLICITY_NO_ERROR; - case 3: *result = LEFTMOST_64_8; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = LEFTMOST_32_16; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFTMOST_64_16; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = LEFTMOST_64_32; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 17: /* Rightmost */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = RIGHTMOST_8_1; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHTMOST_16_1; return SIMPLICITY_NO_ERROR; - case 5: *result = RIGHTMOST_32_1; return SIMPLICITY_NO_ERROR; - case 6: *result = RIGHTMOST_64_1; return SIMPLICITY_NO_ERROR; - } - break; - case 2: - switch (code2) { - case 2: *result = RIGHTMOST_8_2; return SIMPLICITY_NO_ERROR; - case 3: *result = RIGHTMOST_16_2; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHTMOST_32_2; return SIMPLICITY_NO_ERROR; - case 5: *result = RIGHTMOST_64_2; return SIMPLICITY_NO_ERROR; - } - break; - case 3: - switch (code2) { - case 1: *result = RIGHTMOST_8_4; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHTMOST_16_4; return SIMPLICITY_NO_ERROR; - case 3: *result = RIGHTMOST_32_4; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHTMOST_64_4; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = RIGHTMOST_16_8; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHTMOST_32_8; return SIMPLICITY_NO_ERROR; - case 3: *result = RIGHTMOST_64_8; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = RIGHTMOST_32_16; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHTMOST_64_16; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = RIGHTMOST_64_32; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 18: /* LeftPadLow */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = LEFT_PAD_LOW_1_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFT_PAD_LOW_1_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFT_PAD_LOW_1_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LEFT_PAD_LOW_1_64; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = LEFT_PAD_LOW_8_16; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFT_PAD_LOW_8_32; return SIMPLICITY_NO_ERROR; - case 3: *result = LEFT_PAD_LOW_8_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = LEFT_PAD_LOW_16_32; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFT_PAD_LOW_16_64; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = LEFT_PAD_LOW_32_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 19: /* LeftPadHigh */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = LEFT_PAD_HIGH_1_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFT_PAD_HIGH_1_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFT_PAD_HIGH_1_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LEFT_PAD_HIGH_1_64; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = LEFT_PAD_HIGH_8_16; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFT_PAD_HIGH_8_32; return SIMPLICITY_NO_ERROR; - case 3: *result = LEFT_PAD_HIGH_8_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = LEFT_PAD_HIGH_16_32; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFT_PAD_HIGH_16_64; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = LEFT_PAD_HIGH_32_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 20: /* LeftExtend */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = LEFT_EXTEND_1_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFT_EXTEND_1_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFT_EXTEND_1_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LEFT_EXTEND_1_64; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = LEFT_EXTEND_8_16; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFT_EXTEND_8_32; return SIMPLICITY_NO_ERROR; - case 3: *result = LEFT_EXTEND_8_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = LEFT_EXTEND_16_32; return SIMPLICITY_NO_ERROR; - case 2: *result = LEFT_EXTEND_16_64; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = LEFT_EXTEND_32_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 21: /* RightPadLow */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = RIGHT_PAD_LOW_1_8; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHT_PAD_LOW_1_16; return SIMPLICITY_NO_ERROR; - case 5: *result = RIGHT_PAD_LOW_1_32; return SIMPLICITY_NO_ERROR; - case 6: *result = RIGHT_PAD_LOW_1_64; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = RIGHT_PAD_LOW_8_16; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHT_PAD_LOW_8_32; return SIMPLICITY_NO_ERROR; - case 3: *result = RIGHT_PAD_LOW_8_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = RIGHT_PAD_LOW_16_32; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHT_PAD_LOW_16_64; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = RIGHT_PAD_LOW_32_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 22: /* RightPadHigh */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 1: - switch (code2) { - case 3: *result = RIGHT_PAD_HIGH_1_8; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHT_PAD_HIGH_1_16; return SIMPLICITY_NO_ERROR; - case 5: *result = RIGHT_PAD_HIGH_1_32; return SIMPLICITY_NO_ERROR; - case 6: *result = RIGHT_PAD_HIGH_1_64; return SIMPLICITY_NO_ERROR; - } - break; - case 4: - switch (code2) { - case 1: *result = RIGHT_PAD_HIGH_8_16; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHT_PAD_HIGH_8_32; return SIMPLICITY_NO_ERROR; - case 3: *result = RIGHT_PAD_HIGH_8_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = RIGHT_PAD_HIGH_16_32; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHT_PAD_HIGH_16_64; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = RIGHT_PAD_HIGH_32_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 23: /* RightExtend */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - code2 = simplicity_decodeUptoMaxInt(stream); - if (code2 < 0) return (simplicity_err)code2; - switch (code) { - case 4: - switch (code2) { - case 1: *result = RIGHT_EXTEND_8_16; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHT_EXTEND_8_32; return SIMPLICITY_NO_ERROR; - case 3: *result = RIGHT_EXTEND_8_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: - switch (code2) { - case 1: *result = RIGHT_EXTEND_16_32; return SIMPLICITY_NO_ERROR; - case 2: *result = RIGHT_EXTEND_16_64; return SIMPLICITY_NO_ERROR; - } - break; - case 6: - switch (code2) { - case 1: *result = RIGHT_EXTEND_32_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 24: /* LeftShiftWith */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = LEFT_SHIFT_WITH_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFT_SHIFT_WITH_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFT_SHIFT_WITH_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LEFT_SHIFT_WITH_64; return SIMPLICITY_NO_ERROR; - } - break; - case 25: /* RightShiftWith */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = RIGHT_SHIFT_WITH_8; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHT_SHIFT_WITH_16; return SIMPLICITY_NO_ERROR; - case 5: *result = RIGHT_SHIFT_WITH_32; return SIMPLICITY_NO_ERROR; - case 6: *result = RIGHT_SHIFT_WITH_64; return SIMPLICITY_NO_ERROR; - } - break; - case 26: /* LeftShift */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = LEFT_SHIFT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFT_SHIFT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFT_SHIFT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LEFT_SHIFT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 27: /* RightShift */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = RIGHT_SHIFT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHT_SHIFT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = RIGHT_SHIFT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = RIGHT_SHIFT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 28: /* LeftRotate */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = LEFT_ROTATE_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LEFT_ROTATE_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LEFT_ROTATE_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LEFT_ROTATE_64; return SIMPLICITY_NO_ERROR; - } - break; - case 29: /* RightRotate */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = RIGHT_ROTATE_8; return SIMPLICITY_NO_ERROR; - case 4: *result = RIGHT_ROTATE_16; return SIMPLICITY_NO_ERROR; - case 5: *result = RIGHT_ROTATE_32; return SIMPLICITY_NO_ERROR; - case 6: *result = RIGHT_ROTATE_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 2: /* Arith jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - - switch (code) { - case 1: /* One */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = ONE_8; return SIMPLICITY_NO_ERROR; - case 4: *result = ONE_16; return SIMPLICITY_NO_ERROR; - case 5: *result = ONE_32; return SIMPLICITY_NO_ERROR; - case 6: *result = ONE_64; return SIMPLICITY_NO_ERROR; - } - break; - case 2: /* FullAdd */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = FULL_ADD_8; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_ADD_16; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_ADD_32; return SIMPLICITY_NO_ERROR; - case 6: *result = FULL_ADD_64; return SIMPLICITY_NO_ERROR; - } - break; - case 3: /* Add */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = ADD_8; return SIMPLICITY_NO_ERROR; - case 4: *result = ADD_16; return SIMPLICITY_NO_ERROR; - case 5: *result = ADD_32; return SIMPLICITY_NO_ERROR; - case 6: *result = ADD_64; return SIMPLICITY_NO_ERROR; - } - break; - case 4: /* FullIncrement */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = FULL_INCREMENT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_INCREMENT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_INCREMENT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = FULL_INCREMENT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 5: /* Increment */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = INCREMENT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = INCREMENT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = INCREMENT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = INCREMENT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 7: /* FullSubtract */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = FULL_SUBTRACT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_SUBTRACT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_SUBTRACT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = FULL_SUBTRACT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 8: /* Subtract */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = SUBTRACT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = SUBTRACT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = SUBTRACT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = SUBTRACT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 9: /* Negate */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = NEGATE_8; return SIMPLICITY_NO_ERROR; - case 4: *result = NEGATE_16; return SIMPLICITY_NO_ERROR; - case 5: *result = NEGATE_32; return SIMPLICITY_NO_ERROR; - case 6: *result = NEGATE_64; return SIMPLICITY_NO_ERROR; - } - break; - case 10: /* FullDecrement */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = FULL_DECREMENT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_DECREMENT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_DECREMENT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = FULL_DECREMENT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 11: /* Decrement */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = DECREMENT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = DECREMENT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = DECREMENT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = DECREMENT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 12: /* FullMultiply */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = FULL_MULTIPLY_8; return SIMPLICITY_NO_ERROR; - case 4: *result = FULL_MULTIPLY_16; return SIMPLICITY_NO_ERROR; - case 5: *result = FULL_MULTIPLY_32; return SIMPLICITY_NO_ERROR; - case 6: *result = FULL_MULTIPLY_64; return SIMPLICITY_NO_ERROR; - } - break; - case 13: /* Multiply */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = MULTIPLY_8; return SIMPLICITY_NO_ERROR; - case 4: *result = MULTIPLY_16; return SIMPLICITY_NO_ERROR; - case 5: *result = MULTIPLY_32; return SIMPLICITY_NO_ERROR; - case 6: *result = MULTIPLY_64; return SIMPLICITY_NO_ERROR; - } - break; - case 14: /* IsZero */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = IS_ZERO_8; return SIMPLICITY_NO_ERROR; - case 4: *result = IS_ZERO_16; return SIMPLICITY_NO_ERROR; - case 5: *result = IS_ZERO_32; return SIMPLICITY_NO_ERROR; - case 6: *result = IS_ZERO_64; return SIMPLICITY_NO_ERROR; - } - break; - case 15: /* IsOne */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = IS_ONE_8; return SIMPLICITY_NO_ERROR; - case 4: *result = IS_ONE_16; return SIMPLICITY_NO_ERROR; - case 5: *result = IS_ONE_32; return SIMPLICITY_NO_ERROR; - case 6: *result = IS_ONE_64; return SIMPLICITY_NO_ERROR; - } - break; - case 16: /* Le */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = LE_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LE_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LE_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LE_64; return SIMPLICITY_NO_ERROR; - } - break; - case 17: /* Lt */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = LT_8; return SIMPLICITY_NO_ERROR; - case 4: *result = LT_16; return SIMPLICITY_NO_ERROR; - case 5: *result = LT_32; return SIMPLICITY_NO_ERROR; - case 6: *result = LT_64; return SIMPLICITY_NO_ERROR; - } - break; - case 18: /* Min */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = MIN_8; return SIMPLICITY_NO_ERROR; - case 4: *result = MIN_16; return SIMPLICITY_NO_ERROR; - case 5: *result = MIN_32; return SIMPLICITY_NO_ERROR; - case 6: *result = MIN_64; return SIMPLICITY_NO_ERROR; - } - break; - case 19: /* Max */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = MAX_8; return SIMPLICITY_NO_ERROR; - case 4: *result = MAX_16; return SIMPLICITY_NO_ERROR; - case 5: *result = MAX_32; return SIMPLICITY_NO_ERROR; - case 6: *result = MAX_64; return SIMPLICITY_NO_ERROR; - } - break; - case 20: /* Median */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = MEDIAN_8; return SIMPLICITY_NO_ERROR; - case 4: *result = MEDIAN_16; return SIMPLICITY_NO_ERROR; - case 5: *result = MEDIAN_32; return SIMPLICITY_NO_ERROR; - case 6: *result = MEDIAN_64; return SIMPLICITY_NO_ERROR; - } - break; - case 21: /* Div2n1n */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 6: *result = DIV_MOD_128_64; return SIMPLICITY_NO_ERROR; - } - break; - case 22: /* DivMod */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = DIV_MOD_8; return SIMPLICITY_NO_ERROR; - case 4: *result = DIV_MOD_16; return SIMPLICITY_NO_ERROR; - case 5: *result = DIV_MOD_32; return SIMPLICITY_NO_ERROR; - case 6: *result = DIV_MOD_64; return SIMPLICITY_NO_ERROR; - } - break; - case 23: /* Divide */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = DIVIDE_8; return SIMPLICITY_NO_ERROR; - case 4: *result = DIVIDE_16; return SIMPLICITY_NO_ERROR; - case 5: *result = DIVIDE_32; return SIMPLICITY_NO_ERROR; - case 6: *result = DIVIDE_64; return SIMPLICITY_NO_ERROR; - } - break; - case 24: /* Modulo */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = MODULO_8; return SIMPLICITY_NO_ERROR; - case 4: *result = MODULO_16; return SIMPLICITY_NO_ERROR; - case 5: *result = MODULO_32; return SIMPLICITY_NO_ERROR; - case 6: *result = MODULO_64; return SIMPLICITY_NO_ERROR; - } - break; - case 25: /* Divides */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 3: *result = DIVIDES_8; return SIMPLICITY_NO_ERROR; - case 4: *result = DIVIDES_16; return SIMPLICITY_NO_ERROR; - case 5: *result = DIVIDES_32; return SIMPLICITY_NO_ERROR; - case 6: *result = DIVIDES_64; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 3: /* Hash jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: /* SHA-256 section */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = SHA_256_BLOCK; return SIMPLICITY_NO_ERROR; - case 2: *result = SHA_256_IV; return SIMPLICITY_NO_ERROR; - case 3: /* SHA-256-CTX-8-ADD-n subsection */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = SHA_256_CTX_8_ADD_1; return SIMPLICITY_NO_ERROR; - case 2: *result = SHA_256_CTX_8_ADD_2; return SIMPLICITY_NO_ERROR; - case 3: *result = SHA_256_CTX_8_ADD_4; return SIMPLICITY_NO_ERROR; - case 4: *result = SHA_256_CTX_8_ADD_8; return SIMPLICITY_NO_ERROR; - case 5: *result = SHA_256_CTX_8_ADD_16; return SIMPLICITY_NO_ERROR; - case 6: *result = SHA_256_CTX_8_ADD_32; return SIMPLICITY_NO_ERROR; - case 7: *result = SHA_256_CTX_8_ADD_64; return SIMPLICITY_NO_ERROR; - case 8: *result = SHA_256_CTX_8_ADD_128; return SIMPLICITY_NO_ERROR; - case 9: *result = SHA_256_CTX_8_ADD_256; return SIMPLICITY_NO_ERROR; - case 10: *result = SHA_256_CTX_8_ADD_512; return SIMPLICITY_NO_ERROR; - } - break; - case 4: *result = SHA_256_CTX_8_ADD_BUFFER_511; return SIMPLICITY_NO_ERROR; - case 5: *result = SHA_256_CTX_8_FINALIZE; return SIMPLICITY_NO_ERROR; - case 6: *result = SHA_256_CTX_8_INIT; return SIMPLICITY_NO_ERROR; - } - break; - } - break; - case 4: /* Secp256k1 jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: /* point-verify */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = POINT_VERIFY_1; return SIMPLICITY_NO_ERROR; - } - break; - case 2: *result = DECOMPRESS; return SIMPLICITY_NO_ERROR; - case 3: /* linear-verify */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = LINEAR_VERIFY_1; return SIMPLICITY_NO_ERROR; - } - break; - case 4: /* linear-combination */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = LINEAR_COMBINATION_1; return SIMPLICITY_NO_ERROR; - } - break; - case 5: *result = SCALE; return SIMPLICITY_NO_ERROR; - case 6: *result = GENERATE; return SIMPLICITY_NO_ERROR; - case 7: *result = GEJ_INFINITY; return SIMPLICITY_NO_ERROR; - case 8: *result = GEJ_NORMALIZE; return SIMPLICITY_NO_ERROR; - case 9: *result = GEJ_NEGATE; return SIMPLICITY_NO_ERROR; - case 10: *result = GE_NEGATE; return SIMPLICITY_NO_ERROR; - case 11: *result = GEJ_DOUBLE; return SIMPLICITY_NO_ERROR; - case 12: *result = GEJ_ADD; return SIMPLICITY_NO_ERROR; - case 13: *result = GEJ_GE_ADD_EX; return SIMPLICITY_NO_ERROR; - case 14: *result = GEJ_GE_ADD; return SIMPLICITY_NO_ERROR; - case 15: *result = GEJ_RESCALE; return SIMPLICITY_NO_ERROR; - case 16: *result = GEJ_IS_INFINITY; return SIMPLICITY_NO_ERROR; - case 17: *result = GEJ_EQUIV; return SIMPLICITY_NO_ERROR; - case 18: *result = GEJ_GE_EQUIV; return SIMPLICITY_NO_ERROR; - case 19: *result = GEJ_X_EQUIV; return SIMPLICITY_NO_ERROR; - case 20: *result = GEJ_Y_IS_ODD; return SIMPLICITY_NO_ERROR; - case 21: *result = GEJ_IS_ON_CURVE; return SIMPLICITY_NO_ERROR; - case 22: *result = GE_IS_ON_CURVE; return SIMPLICITY_NO_ERROR; - case 23: *result = SCALAR_NORMALIZE; return SIMPLICITY_NO_ERROR; - case 24: *result = SCALAR_NEGATE; return SIMPLICITY_NO_ERROR; - case 25: *result = SCALAR_ADD; return SIMPLICITY_NO_ERROR; - case 26: *result = SCALAR_SQUARE; return SIMPLICITY_NO_ERROR; - case 27: *result = SCALAR_MULTIPLY; return SIMPLICITY_NO_ERROR; - case 28: *result = SCALAR_MULTIPLY_LAMBDA; return SIMPLICITY_NO_ERROR; - case 29: *result = SCALAR_INVERT; return SIMPLICITY_NO_ERROR; - case 30: *result = SCALAR_IS_ZERO; return SIMPLICITY_NO_ERROR; - - case 35: *result = FE_NORMALIZE; return SIMPLICITY_NO_ERROR; - case 36: *result = FE_NEGATE; return SIMPLICITY_NO_ERROR; - case 37: *result = FE_ADD; return SIMPLICITY_NO_ERROR; - case 38: *result = FE_SQUARE; return SIMPLICITY_NO_ERROR; - case 39: *result = FE_MULTIPLY; return SIMPLICITY_NO_ERROR; - case 40: *result = FE_MULTIPLY_BETA; return SIMPLICITY_NO_ERROR; - case 41: *result = FE_INVERT; return SIMPLICITY_NO_ERROR; - case 42: *result = FE_SQUARE_ROOT; return SIMPLICITY_NO_ERROR; - case 43: *result = FE_IS_ZERO; return SIMPLICITY_NO_ERROR; - case 44: *result = FE_IS_ODD; return SIMPLICITY_NO_ERROR; - - case 46: *result = HASH_TO_CURVE; return SIMPLICITY_NO_ERROR; - case 47: *result = SWU; return SIMPLICITY_NO_ERROR; - } - break; - case 5: /* Signature jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = CHECK_SIG_VERIFY; return SIMPLICITY_NO_ERROR; - case 2: *result = BIP_0340_VERIFY; return SIMPLICITY_NO_ERROR; - } - break; - case 7: /* Bitcoin jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = PARSE_LOCK; return SIMPLICITY_NO_ERROR; - case 2: *result = PARSE_SEQUENCE; return SIMPLICITY_NO_ERROR; - case 3: *result = TAPDATA_INIT; return SIMPLICITY_NO_ERROR; - } - break; - } +#include "../../decodeCoreJets.inc" return SIMPLICITY_ERR_DATA_OUT_OF_RANGE; } else { /* Elements jets */ - int32_t code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: /* SigHash jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = SIG_ALL_HASH; return SIMPLICITY_NO_ERROR; - case 2: *result = TX_HASH; return SIMPLICITY_NO_ERROR; - case 3: *result = TAP_ENV_HASH; return SIMPLICITY_NO_ERROR; - case 4: *result = OUTPUTS_HASH; return SIMPLICITY_NO_ERROR; - case 5: *result = INPUTS_HASH; return SIMPLICITY_NO_ERROR; - case 6: *result = ISSUANCES_HASH; return SIMPLICITY_NO_ERROR; - case 7: *result = INPUT_UTXOS_HASH; return SIMPLICITY_NO_ERROR; - case 8: *result = OUTPUT_HASH; return SIMPLICITY_NO_ERROR; - case 9: *result = OUTPUT_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; - case 10: *result = OUTPUT_SCRIPTS_HASH; return SIMPLICITY_NO_ERROR; - case 11: *result = OUTPUT_NONCES_HASH; return SIMPLICITY_NO_ERROR; - case 12: *result = OUTPUT_RANGE_PROOFS_HASH; return SIMPLICITY_NO_ERROR; - case 13: *result = OUTPUT_SURJECTION_PROOFS_HASH; return SIMPLICITY_NO_ERROR; - case 14: *result = INPUT_HASH; return SIMPLICITY_NO_ERROR; - case 15: *result = INPUT_OUTPOINTS_HASH; return SIMPLICITY_NO_ERROR; - case 16: *result = INPUT_SEQUENCES_HASH; return SIMPLICITY_NO_ERROR; - case 17: *result = INPUT_ANNEXES_HASH; return SIMPLICITY_NO_ERROR; - case 18: *result = INPUT_SCRIPT_SIGS_HASH; return SIMPLICITY_NO_ERROR; - case 19: *result = ISSUANCE_HASH; return SIMPLICITY_NO_ERROR; - case 20: *result = ISSUANCE_ASSET_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; - case 21: *result = ISSUANCE_TOKEN_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; - case 22: *result = ISSUANCE_RANGE_PROOFS_HASH; return SIMPLICITY_NO_ERROR; - case 23: *result = ISSUANCE_BLINDING_ENTROPY_HASH; return SIMPLICITY_NO_ERROR; - case 24: *result = INPUT_UTXO_HASH; return SIMPLICITY_NO_ERROR; - case 25: *result = INPUT_AMOUNTS_HASH; return SIMPLICITY_NO_ERROR; - case 26: *result = INPUT_SCRIPTS_HASH; return SIMPLICITY_NO_ERROR; - case 27: *result = TAPLEAF_HASH; return SIMPLICITY_NO_ERROR; - case 28: *result = TAPPATH_HASH; return SIMPLICITY_NO_ERROR; - case 29: *result = OUTPOINT_HASH; return SIMPLICITY_NO_ERROR; - case 30: *result = ASSET_AMOUNT_HASH; return SIMPLICITY_NO_ERROR; - case 31: *result = NONCE_HASH; return SIMPLICITY_NO_ERROR; - case 32: *result = ANNEX_HASH; return SIMPLICITY_NO_ERROR; - case 33: *result = BUILD_TAPLEAF_SIMPLICITY; return SIMPLICITY_NO_ERROR; - case 34: *result = BUILD_TAPBRANCH; return SIMPLICITY_NO_ERROR; - case 35: *result = BUILD_TAPTWEAK; return SIMPLICITY_NO_ERROR; - } - break; - case 2: /* Timelock jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = CHECK_LOCK_HEIGHT; return SIMPLICITY_NO_ERROR; - case 2: *result = CHECK_LOCK_TIME; return SIMPLICITY_NO_ERROR; - case 3: *result = CHECK_LOCK_DISTANCE; return SIMPLICITY_NO_ERROR; - case 4: *result = CHECK_LOCK_DURATION; return SIMPLICITY_NO_ERROR; - case 5: *result = TX_LOCK_HEIGHT; return SIMPLICITY_NO_ERROR; - case 6: *result = TX_LOCK_TIME; return SIMPLICITY_NO_ERROR; - case 7: *result = TX_LOCK_DISTANCE; return SIMPLICITY_NO_ERROR; - case 8: *result = TX_LOCK_DURATION; return SIMPLICITY_NO_ERROR; - case 9: *result = TX_IS_FINAL; return SIMPLICITY_NO_ERROR; - } - break; - case 3: /* Issuance jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = ISSUANCE; return SIMPLICITY_NO_ERROR; - case 2: *result = ISSUANCE_ASSET; return SIMPLICITY_NO_ERROR; - case 3: *result = ISSUANCE_TOKEN; return SIMPLICITY_NO_ERROR; - case 4: *result = ISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; - case 5: *result = CALCULATE_ISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; - case 6: *result = CALCULATE_ASSET; return SIMPLICITY_NO_ERROR; - case 7: *result = CALCULATE_EXPLICIT_TOKEN; return SIMPLICITY_NO_ERROR; - case 8: *result = CALCULATE_CONFIDENTIAL_TOKEN; return SIMPLICITY_NO_ERROR; - case 9: *result = LBTC_ASSET; return SIMPLICITY_NO_ERROR; - } - break; - case 4: /* Transaction jets chapter */ - code = simplicity_decodeUptoMaxInt(stream); - if (code < 0) return (simplicity_err)code; - switch (code) { - case 1: *result = SCRIPT_CMR; return SIMPLICITY_NO_ERROR; - case 2: *result = INTERNAL_KEY; return SIMPLICITY_NO_ERROR; - case 3: *result = CURRENT_INDEX; return SIMPLICITY_NO_ERROR; - case 4: *result = NUM_INPUTS; return SIMPLICITY_NO_ERROR; - case 5: *result = NUM_OUTPUTS; return SIMPLICITY_NO_ERROR; - case 6: *result = LOCK_TIME; return SIMPLICITY_NO_ERROR; - case 7: *result = OUTPUT_ASSET; return SIMPLICITY_NO_ERROR; - case 8: *result = OUTPUT_AMOUNT; return SIMPLICITY_NO_ERROR; - case 9: *result = OUTPUT_NONCE; return SIMPLICITY_NO_ERROR; - case 10: *result = OUTPUT_SCRIPT_HASH; return SIMPLICITY_NO_ERROR; - case 11: *result = OUTPUT_NULL_DATUM; return SIMPLICITY_NO_ERROR; - case 12: *result = OUTPUT_IS_FEE; return SIMPLICITY_NO_ERROR; - case 13: *result = OUTPUT_SURJECTION_PROOF; return SIMPLICITY_NO_ERROR; - case 14: *result = OUTPUT_RANGE_PROOF; return SIMPLICITY_NO_ERROR; - case 15: *result = TOTAL_FEE; return SIMPLICITY_NO_ERROR; - case 16: *result = CURRENT_PEGIN; return SIMPLICITY_NO_ERROR; - case 17: *result = CURRENT_PREV_OUTPOINT; return SIMPLICITY_NO_ERROR; - case 18: *result = CURRENT_ASSET; return SIMPLICITY_NO_ERROR; - case 19: *result = CURRENT_AMOUNT; return SIMPLICITY_NO_ERROR; - case 20: *result = CURRENT_SCRIPT_HASH; return SIMPLICITY_NO_ERROR; - case 21: *result = CURRENT_SEQUENCE; return SIMPLICITY_NO_ERROR; - case 22: *result = CURRENT_ANNEX_HASH; return SIMPLICITY_NO_ERROR; - case 23: *result = CURRENT_SCRIPT_SIG_HASH; return SIMPLICITY_NO_ERROR; - case 24: *result = CURRENT_REISSUANCE_BLINDING; return SIMPLICITY_NO_ERROR; - case 25: *result = CURRENT_NEW_ISSUANCE_CONTRACT; return SIMPLICITY_NO_ERROR; - case 26: *result = CURRENT_REISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; - case 27: *result = CURRENT_ISSUANCE_ASSET_AMOUNT; return SIMPLICITY_NO_ERROR; - case 28: *result = CURRENT_ISSUANCE_TOKEN_AMOUNT; return SIMPLICITY_NO_ERROR; - case 29: *result = CURRENT_ISSUANCE_ASSET_PROOF; return SIMPLICITY_NO_ERROR; - case 30: *result = CURRENT_ISSUANCE_TOKEN_PROOF; return SIMPLICITY_NO_ERROR; - case 31: *result = INPUT_PEGIN; return SIMPLICITY_NO_ERROR; - case 32: *result = INPUT_PREV_OUTPOINT; return SIMPLICITY_NO_ERROR; - case 33: *result = INPUT_ASSET; return SIMPLICITY_NO_ERROR; - case 34: *result = INPUT_AMOUNT; return SIMPLICITY_NO_ERROR; - case 35: *result = INPUT_SCRIPT_HASH; return SIMPLICITY_NO_ERROR; - case 36: *result = INPUT_SEQUENCE; return SIMPLICITY_NO_ERROR; - case 37: *result = INPUT_ANNEX_HASH; return SIMPLICITY_NO_ERROR; - case 38: *result = INPUT_SCRIPT_SIG_HASH; return SIMPLICITY_NO_ERROR; - case 39: *result = REISSUANCE_BLINDING; return SIMPLICITY_NO_ERROR; - case 40: *result = NEW_ISSUANCE_CONTRACT; return SIMPLICITY_NO_ERROR; - case 41: *result = REISSUANCE_ENTROPY; return SIMPLICITY_NO_ERROR; - case 42: *result = ISSUANCE_ASSET_AMOUNT; return SIMPLICITY_NO_ERROR; - case 43: *result = ISSUANCE_TOKEN_AMOUNT; return SIMPLICITY_NO_ERROR; - case 44: *result = ISSUANCE_ASSET_PROOF; return SIMPLICITY_NO_ERROR; - case 45: *result = ISSUANCE_TOKEN_PROOF; return SIMPLICITY_NO_ERROR; - case 46: *result = TAPLEAF_VERSION; return SIMPLICITY_NO_ERROR; - case 47: *result = TAPPATH; return SIMPLICITY_NO_ERROR; - case 48: *result = VERSION; return SIMPLICITY_NO_ERROR; - case 49: *result = GENESIS_BLOCK_HASH; return SIMPLICITY_NO_ERROR; - case 50: *result = TRANSACTION_ID; return SIMPLICITY_NO_ERROR; - } - break; - } +#include "decodeElementsJets.inc" return SIMPLICITY_ERR_DATA_OUT_OF_RANGE; } } diff --git a/Haskell-Generate/GenDecodeJet.hs b/Haskell-Generate/GenDecodeJet.hs new file mode 100644 index 000000000..ebf40d25d --- /dev/null +++ b/Haskell-Generate/GenDecodeJet.hs @@ -0,0 +1,49 @@ +{-# LANGUAGE OverloadedStrings, QuantifiedConstraints, RankNTypes, ScopedTypeVariables #-} +module GenDecodeJet where + +import Data.Maybe (catMaybes) +import Prettyprinter ( Doc, (<+>), braces, colon, line, nest, pretty, semi, vsep + , SimpleDocStream, LayoutOptions(..), PageWidth(..), defaultLayoutOptions, layoutPretty + ) +import Prettyprinter.Render.Text (renderIO) +import System.IO (IOMode(WriteMode), withFile) + +import NameWrangler +import Simplicity.CoreJets (coreCatalogue) +import Simplicity.Elements.Jets (elementsCatalogue) +import Simplicity.Ty +import Simplicity.Tree + +x <-> y = x <> line <> y + +nestBraces x = braces (nest 2 (line <> x) <> line) + +labelCase ix = "case" <+> pretty ix <> colon + +decodeCatalogue :: Catalogue String -> Doc a +decodeCatalogue Missing = mempty +decodeCatalogue (Item name) = + "*result =" <+> pretty (upperSnakeCase name) <> semi <+> + "return SIMPLICITY_NO_ERROR" <> semi +decodeCatalogue (Shelf l) = vsep + [ "code = simplicity_decodeUptoMaxInt(stream)" <> semi + , "if (code < 0) return (simplicity_err)code" <> semi + , "switch (code)" <+> nestBraces (vsep cases) + ] + where + cases = catMaybes $ zipWith f [(1::Int)..] l + f _ Missing = Nothing + f ix cat@(Item _) = Just . nest 2 $ labelCase ix <+> decodeCatalogue cat + f ix cat@(Shelf _) = Just . nest 2 $ labelCase ix <-> decodeCatalogue cat <-> "break" <> semi + +renderFile name doc = withFile name WriteMode (\h -> renderIO h (layoutPretty layoutOptions (header <-> doc))) + where + header = "/* This file has been automatically generated. */\n" + +main = do + renderFile "decodeCoreJets.inc" (wrap (decodeCatalogue (mkName <$> coreCatalogue))) + renderFile "decodeElementsJets.inc" (wrap (decodeCatalogue (mkName <$> elementsCatalogue))) + where + wrap doc = nestBraces ("int32_t code;" <-> doc) + +layoutOptions = LayoutOptions { layoutPageWidth = AvailablePerLine 100 1 } diff --git a/Haskell/Core/Simplicity/CoreJets.hs b/Haskell/Core/Simplicity/CoreJets.hs index 00724c5e5..96d4b0c6a 100644 --- a/Haskell/Core/Simplicity/CoreJets.hs +++ b/Haskell/Core/Simplicity/CoreJets.hs @@ -5,6 +5,7 @@ {-# LANGUAGE RankNTypes, GADTs, StandaloneDeriving, ScopedTypeVariables, TypeFamilies #-} module Simplicity.CoreJets ( CoreJet(..), WordJet(..), ArithJet(..), HashJet(..), Secp256k1Jet(..), SignatureJet(..), BitcoinJet(..) + , coreCatalogue , specification, coreJetMap, coreJetLookup , implementation , fastCoreEval @@ -1529,6 +1530,7 @@ implementationBitcoin TapdataInit v = toCtx <$> ctxAdd ctxInit (tag<>tag) getJetBit :: (Monad m) => m Void -> m Bool -> m (SomeArrow CoreJet) getJetBit = getCatalogue coreCatalogue +-- | A 'Catalogue' of the core jets. The structure informs the canonical serialization format for the jets. coreCatalogue :: Catalogue (SomeArrow CoreJet) coreCatalogue = Shelf [ someArrowMap WordJet <$> wordBook diff --git a/Haskell/Simplicity/Elements/Jets.hs b/Haskell/Simplicity/Elements/Jets.hs index d3d8c8e1f..380d236d0 100644 --- a/Haskell/Simplicity/Elements/Jets.hs +++ b/Haskell/Simplicity/Elements/Jets.hs @@ -2,6 +2,7 @@ {-# LANGUAGE GADTs, StandaloneDeriving, TypeFamilies #-} module Simplicity.Elements.Jets ( JetType(..), ElementsJet(..), SigHashJet(..), TimeLockJet(..), IssuanceJet(..), TransactionJet(..) + , elementsCatalogue , asJet , jetSubst, pruneSubst , getTermLengthCode, putTermLengthCode diff --git a/Simplicity.cabal b/Simplicity.cabal index 4ab4bdd3f..625fbcac6 100644 --- a/Simplicity.cabal +++ b/Simplicity.cabal @@ -252,6 +252,23 @@ Test-Suite testsuite transformers >=0.5 && <0.7, vector >=0.12 && <0.14 +executable GenDecodeJet + main-is: GenDecodeJet.hs + ghc-options: -main-is GenDecodeJet + + -- Modules included in this executable, other than Main. + -- other-modules: + + -- LANGUAGE extensions used by modules in this package. + -- other-extensions: + hs-source-dirs: Haskell-Generate + default-language: Haskell2010 + other-modules: NameWrangler + build-depends: Simplicity, + base >=4.9 && <4.20, + prettyprinter >=1.7 && <1.8, + split >=0.2.3 && <0.3, + executable GenPrecomputed main-is: GenPrecomputed.hs ghc-options: -main-is GenPrecomputed