mardi 29 novembre 2016

standard c++ for test_and_set_bit

I am trying to use the highest bit(it is unused) as a lock for each element in an array so I can compress the memory to the fullest.

The test_and_set_bit of linux kernel looks promising, but I want to make it platform unrelated. And to now, I find the best way to achieve this is gcc __sync_fetch_and_OP.

Is there a more elegant way to achieve this? Thanks in advance. :-)

Aucun commentaire:

Enregistrer un commentaire