Coverage for cuda / core / system / _device_utils.pxi: 90.91%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-08 01:07 +0000

1# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4  

5from libc.stdint cimport uint64_t 

6  

7  

8cpdef inline list[int] _unpack_bitmask(uint64_t[:] arr): 

9 """ 

10 Unpack a list of integers containing bitmasks. 

11 """ 

12 cdef uint64_t i, j, idx 

13 cdef int mask_bits = 64 1abcdefghij

14  

15 res = [] 1abcdefghij

16  

17 for i in range(len(arr)): 1abcdefghij

18 cpu_offset = i * mask_bits 1abcdefghij

19 idx = 1 1abcdefghij

20 for j in range(mask_bits): 1abcdefghij

21 if arr[i] & idx: 1abcdefghij

22 res.append(cpu_offset + j) 1abcdefghij

23 idx <<= 1 1abcdefghij

24 return res 1abcdefghij