What's the purpose of the code:

void wait ( int *ptr, int k) { while ((1 << k) & (*ptr) == 0) {} }