Coverage for cuda/core/system/_device_utils.pxi: 90.91%
11 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-13 01:38 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-13 01:38 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
5from libc.stdint cimport uint64_t
8def _unpack_bitmask(arr: object) -> list[int]:
9 """
10 Unpack a list of integers containing bitmasks.
11 """
12 cdef uint64_t i, j, idx
13 cdef int mask_bits = 64 1abcdefghij
15 res = [] 1abcdefghij
17 for i in range(len(arr)): 1abcdefghij
18 cpu_offset = i * mask_bits 1abcdefghi
19 idx = 1 1abcdefghi
20 for j in range(mask_bits): 1abcdefghi
21 if arr[i] & idx: 1abcdefghi
22 res.append(cpu_offset + j) 1abcdefghi
23 idx <<= 1 1abcdefghi
24 return res 1abcdefghi