Hey Bruno,
On 01.06.2011 16:48, Bruno Bresciani wrote:
I can't understand the has_tran_tmcbs function...
Can someone tell me
how it works?
The function checks if, for a given transaction T and a bitfield of
callbacks, any of the callbacks are registered for T.
It does so my logically ANDing the transaction bitfield (which
represents the set of registered callbacks) with the bitfield of
callbacks you would like to be checked. For each callback actually
registered, the corresponding pair of bits will yield one w.r.t. to the
AND operation. Therefore, if at least one of the given callbacks is
registered, the entire AND operation will result in a value greater
zero, thereby indicating that the transaction does have at least one of
the given callbacks registered.
For instance, if the bitfield of registered callbacks for T is 1011, and
it is to be checked whether the callback bitfield 0110 matches, the
outcome of 1011 & 0110 = 0010 > 0, meaning that at least one of the
given callbacks is registered (which, in this example, happens to be the
second transaction callback defined in t_hooks.h).
HTH,
--Timo