Write 'len' bytes to a Simplicity buffer of type (TWO^8)^<2^(n+1) from 'buf'. * Advance the 'dst' frame to the end of the buffer type. * * The notation X^<2 is notation for the type (S X) * The notation X^<(2*n) is notation for the type S (X^n) * X^<n * * Precondition: '*dst' is a valid write frame for 8*(2^(n+1)-1)+n+1 more cells; * unsigned char buf[len]; * le
| 127 | * 0 <= n < 16; |
| 128 | */ |
| 129 | void simplicity_write_buffer8(frameItem* dst, const unsigned char* buf, size_t len, int n) { |
| 130 | simplicity_debug_assert(0 <= n && n < 16); |
| 131 | simplicity_debug_assert(len < ((size_t)1<<(n+1))); |
| 132 | for (size_t i = (size_t)1 << n; 0 < i; i /= 2) { |
| 133 | if (writeBit(dst, i <= len)) { |
| 134 | write8s(dst, buf, i); |
| 135 | buf += i; len -= i; |
| 136 | } else { |
| 137 | skipBits(dst, i*8); |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /* Read data from a Simplicity CTX8 type (TWO^8)^<2^64 * TWO^64 * TWO^256 and fill in a sha256_context value. |
| 143 | * Advance the 'src' frame to the end of the CTX8 type. |
no test coverage detected