projects
/
debian
/
gnuradio
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
591c12f
)
Add gru.hexshort to deal with short hex constants
author
Eric Blossom
<eb@comsec.com>
Mon, 10 May 2010 21:31:15 +0000
(14:31 -0700)
committer
Eric Blossom
<eb@comsec.com>
Mon, 10 May 2010 21:31:15 +0000
(14:31 -0700)
gnuradio-core/src/python/gnuradio/gruimpl/hexint.py
patch
|
blob
|
history
diff --git
a/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py
b/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py
index 8d46e8192f90924ab72368c45f5611047f5d6388..f2808c44890a3188029edc352f32ca8b7e05df5b 100644
(file)
--- a/
gnuradio-core/src/python/gnuradio/gruimpl/hexint.py
+++ b/
gnuradio-core/src/python/gnuradio/gruimpl/hexint.py
@@
-30,3
+30,15
@@
def hexint(mask):
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