need help on converting xoroshiro128++ to operate with limited registers and memory
00:26 22 Jan 2026

I need help on converting xoroshiro128++ to operate with limited registers and memory. Reference code of xoroshiro128++ is listed below:

static inline uint64_t rotl(const uint64_t x, int k) {
    return (x << k) | (x >> (64 - k));
}


static uint64_t s[2];

uint64_t next(void) {
    const uint64_t s0 = s[0];
    uint64_t s1 = s[1];
    const uint64_t result = rotl(s0 + s1, 17) + s0;

    s1 ^= s0;
    s[0] = rotl(s0, 49) ^ s1 ^ (s1 << 21); // a, b
    s[1] = rotl(s1, 28); // c

    return result;
}

And I'm trying to port it to a 32bit platform which doesn't do 64bit math and with limited amount of registers and memory for storing intermediates, but I still need 64bit output from the function.

c algorithm random