News for hackers. Stuff that matters.
Re:X86 is a high-level language by rdc12 on Wednesday March 25, 2015 @06:09PM (#9266325)
One of the links on the post, links to a stack overflow question, that has this code. What is the purpose of the do-while loop with the condition 0, how is that different to not having the loop at all?

#define BN_CONSTTIME_SWAP(ind) \

  do { \

    t = (a->d[ind] ^ b->d[ind]) & condition; \

    a->d[ind] ^= t; \

    b->d[ind] ^= t; \

  } while (0)
Re:X86 is a high-level language by stephencanon on Wednesday March 25, 2015 @06:13PM (#9266363)
It's a common C macro idiom, that makes a multi-statment macro behave like a single statement. See http://stackoverflow.com/questions/154136/do-while-and-if-el...
Re:X86 is a high-level language by bmm6o on Wednesday March 25, 2015 @06:16PM (#9266382)
do with a while (0) executes the body one time. This trick is used to package several statements into one, so it can be used in places like:

if (foo) BN_CONSTTIME_SWAP(0);