dimanche 20 décembre 2020

What does return y = x; mean? [duplicate]

In Xorshift algorithm

struct xorshift32_state {
  uint32_t a;
};

/* The state word must be initialized to non-zero */
uint32_t xorshift32(struct xorshift32_state *state)
{
    /* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */
    uint32_t x = state->a;
    x ^= x << 13;
    x ^= x >> 17;
    x ^= x << 5;
    return state->a = x;
}

Does return state->a = x; assign x to state->a and returns x? Where can I read about such usage of statement, I believe it's new to C++11 or 14?

Aucun commentaire:

Enregistrer un commentaire