[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] gr.and_const_ss Overflow error with values over 0
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] gr.and_const_ss Overflow error with values over 0x7FFF? |
Date: |
Mon, 10 May 2010 14:34:45 -0700 |
User-agent: |
Mutt/1.5.20 (2009-08-17) |
On Tue, May 11, 2010 at 09:12:40AM +1200, Drew Read wrote:
> Hi All,
>
> Does anyone have any idea what's happening here? It seems like
> gr.and_const_ss(short k) wont accept any values of k greater than
> 0x7fff.
> It's a bit of a problem for using gr-gpio where the use case would be
> gr.and_const_ss(0xEFFF) to get only the analog portion of the samples.
>
> Executing z = gr.and_const_ss(0x7fff) works fine
> but z = gr.and_const_ss(0x8000) results in:
>
> >>> z = gr.and_const_ss(0x8000)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/usr/local/lib/python2.6/dist-packages/gnuradio/gr/gnuradio_swig_py_gengen.py",
> line 1636, in and_const_ss
> return _gnuradio_swig_py_gengen.and_const_ss(*args, **kwargs)
> OverflowError: in method 'and_const_ss', argument 1 of type 'short'
>
> I've git pulled with no improvement and I'm running Ubuntu 10.04 LTS.
> This issue can be reproduced using either an interactive Python console
> or by running gnuradio/gr-gpio/src/python/gpio_rx_sfile.py
>
> Also multiply_const_ss is doing the same thing.
>
> Maybe I need to raise this as an issue?
>
> Thanks for any help,
> Drew
It's a side effect of the conversion between Python and C++.
I just pushed an update to master that gives you a way to deal with
what SWIG thinks are hex values that won't fit in a short.
address@hidden ~]$ python
Python 2.6.2 (r262:71600, Jan 25 2010, 18:46:47)
[GCC 4.4.2 20091222 (Red Hat 4.4.2-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gnuradio import gr, gru
>>> z=gr.and_const_ss(gru.hexshort(0x8000))
>>> gru.hexshort(0x8000)
-32768
>>> gru.hexshort(0xFFE0)
-32
Eric