| 83 | } |
| 84 | |
| 85 | static uint32_t chacha_next32(mi_random_ctx_t* ctx) { |
| 86 | if (ctx->output_available <= 0) { |
| 87 | chacha_block(ctx); |
| 88 | ctx->output_available = 16; // (assign again to suppress static analysis warning) |
| 89 | } |
| 90 | const uint32_t x = ctx->output[16 - ctx->output_available]; |
| 91 | ctx->output[16 - ctx->output_available] = 0; // reset once the data is handed out |
| 92 | ctx->output_available--; |
| 93 | return x; |
| 94 | } |
| 95 | |
| 96 | static inline uint32_t read32(const uint8_t* p, size_t idx32) { |
| 97 | const size_t i = 4*idx32; |
no test coverage detected