blob: ad568b59a65474d9530426bf03ffec4d14dc29b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#
# Copyright 2005 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
def hexint(mask):
"""
Convert unsigned masks into signed ints.
This allows us to use hex constants like 0xf0f0f0f2 when talking to
our hardware and not get screwed by them getting treated as python
longs.
"""
if mask >= 2**31:
return int(mask-2**32)
return mask
def hexshort(mask):
"""
Convert unsigned masks into signed shorts.
This allows us to use hex constants like 0x8000 when talking to
our hardware and not get screwed by them getting treated as python
longs.
"""
if mask >= 2**15:
return int(mask-2**16)
return mask
|