Hacker News new | past | comments | ask | show | jobs | submit login

How does the version with buf0 and buf1 work? It looks like it sends always the same two values...



Hmmm, yes. I didn't understand what the code did.

Instead of creating those buff0 and buff1 variables before the loop, I should have done:

    for (int i = 0; i < 10; ++i) {
        unsigned a = i;
        unsigned b = i+1;
        msg->a = a;
        msg->b = b;
        SendWord(a);
        SendWord(b);   
    }
That gets rid of the load from the loop. https://godbolt.org/z/xsqWfxKzd




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: