Integrate DS4 execution parity in Rust
This commit is contained in:
23
scripts/fixtures/mtp_copy_prompt.txt
Normal file
23
scripts/fixtures/mtp_copy_prompt.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
Reproduce the following C code EXACTLY, character for character, inside a single code block and output nothing else:
|
||||
|
||||
```c
|
||||
static uint32_t clamp_u32(uint32_t v, uint32_t lo, uint32_t hi) {
|
||||
if (v < lo) return lo;
|
||||
if (v > hi) return hi;
|
||||
return v;
|
||||
}
|
||||
|
||||
static uint32_t ring_advance(uint32_t pos, uint32_t cap) {
|
||||
uint32_t next = pos + 1u;
|
||||
return next >= cap ? 0u : next;
|
||||
}
|
||||
|
||||
static int scratch_init(scratch *s, uint32_t ctx_size) {
|
||||
if (ctx_size == 0u) ctx_size = 1u;
|
||||
s->ctx_size = ctx_size;
|
||||
s->comp_cap = ctx_size / 4u + 2u;
|
||||
s->rows = clamp_u32(s->comp_cap, 1u, 4096u);
|
||||
s->head = 0u;
|
||||
return s->rows > 0u ? 0 : -1;
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user