summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authoreb2008-08-15 01:12:02 +0000
committereb2008-08-15 01:12:02 +0000
commitf806d765aab07876d073b60ad3cc5d3df321b87f (patch)
treef52e32099c58c95d8eaa52dd2ea34ba611d25b65 /gnuradio-core
parentc5241ccab38d16a529c9ccc9ca10e2fc8e6e5a59 (diff)
downloadgnuradio-f806d765aab07876d073b60ad3cc5d3df321b87f.tar.gz
gnuradio-f806d765aab07876d073b60ad3cc5d3df321b87f.tar.bz2
gnuradio-f806d765aab07876d073b60ad3cc5d3df321b87f.zip
Trial fix for ticket:258 / integer overflow undefined / phase
accumulator. Thanks to Stefan Bruens and Philip Ballister for working on this. According to the fine print in the C and C++ standards, if a signed integer type overflows, the result is undefined. As of gcc 4.3, gcc was proving that our code was overflowing, and took advantage of the "undefined" result to short circuit the evaluation. Moral of the story: if you're using a fixed point phase accumulator, or anything else where you're counting on overflow happening, be sure that your variable is unsigned. See also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37067 and http://www.airs.com/blog/archives/120 git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9296 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt_nco.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gnuradio-core/src/lib/general/gr_fxpt_nco.h b/gnuradio-core/src/lib/general/gr_fxpt_nco.h
index 6487a5f48..ca0d54f02 100644
--- a/gnuradio-core/src/lib/general/gr_fxpt_nco.h
+++ b/gnuradio-core/src/lib/general/gr_fxpt_nco.h
@@ -30,7 +30,7 @@
* \ingroup misc
*/
class gr_fxpt_nco {
- gr_int32 d_phase;
+ gr_uint32 d_phase;
gr_int32 d_phase_inc;
public: