Skip to content
Snippets Groups Projects
Verified Commit 561ec6c2 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Make is_bit_set numba compatible

parent 4b8448f0
No related branches found
No related tags found
1 merge request!66Make bit checker numba compatible
......@@ -493,15 +493,16 @@ def usr(objects, field):
return objects.usr[:, idx]
@nb.vectorize(("boolean(int64, int64)", "boolean(uint64, int64)"), nopython=True)
def is_bit_set(value, bit_position):
"""Returns true if a bit at the given position is 1.
value: int or array(int)
value: int or array([u]int64)
The value to check, can be a single value or an array of values.
bit_position: int
0 for the first position, 1 for the second etc.
"""
return (np.array(value) & (1 << bit_position)).astype(bool)
return bool(value & (1 << bit_position))
def is_3dshower(trigger_mask):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment