https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115955
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- std::barrier does: std::hash<std::thread::id> __hasher; size_t __current = __hasher(std::this_thread::get_id()); Maybe this could be improved too, although it doesn't have exactly the same issue (not all thread IDs are separated by a constant power-of-two value).