![]() ![]() ![]() ![]() Next: Accessing the mask from Up: Accessing the mask from Previous: Setting and checking mask Contents Faster bitwise operatorsThe above mentioned functions for checking and setting the mask are rather inefficient, since they require strings to be compared at each point. A set of faster macros are provided which operate on the mask by performing bit operations directly. In order to use these functions, the bitmasks corresponding to the desired type and it's states need to be obtained using the following functions:
Each of these functions returns a CCTK_INT8 which holds the
bitmask corresponding to the given type or state. For example, if a
given type uses three bits of the mask, the returned value could be
the integer corresponding to the bitfield All of the state masks allocated for a given type can be retrieved using the following function:
The return value is a list of integers, with a length corresponding to the number of states of the given type. Each of the entries is a bitmask which identifies the state. List entries are returned in the order in which they were originally assigned. This allows for a simple correspondence between states and integers (given by the index of the list entry). A fortran wrapper does not currently exist for this functionality. The following macros have been defined for fast setting and checking of the mask by direct bitwise operations:
The latter macro returns a 1 if the given state has been set, a 0 otherwise. The type_bits and state_bits can be obtained using the SpaceMask_Get*Bits functions, described above.
![]() ![]() ![]() ![]() Next: Accessing the mask from Up: Accessing the mask from Previous: Setting and checking mask Contents |