[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch-gnuradio] gr_head should take longs
From: |
Eric Blossom |
Subject: |
Re: [Patch-gnuradio] gr_head should take longs |
Date: |
Sat, 5 Dec 2009 06:43:19 -0800 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Thu, Dec 03, 2009 at 09:30:47AM +0100, Martin Braun wrote:
> On Wed, Dec 02, 2009 at 02:13:35PM -0800, Eric Blossom wrote:
> > This should be "long long" if you want a 64-bit value.
> > Can you please resubmit? Thanks!
> >
> > On x86:
> >
> > $ ./sizeof-long
> > sizeof(int) = 4
> > sizeof(unsigned long) = 4
> > sizeof(long long) = 8
> >
> > On x86_64:
> >
> > $ ./sizeof-long
> > sizeof(int) = 4
> > sizeof(unsigned long) = 8
> > sizeof(long long) = 8
>
> Well, I guess that gives away the platform I'm using :)
> Sorry about that, I admit some lack of experience in the whole
> cross-platform area.
>
> Here comes the new patch,
> MB
Thanks, Martin!
Eric
> --
> Karlsruhe Institute of Technology (KIT)
> Communications Engineering Lab (CEL)
>
> Dipl.-Ing. Martin Braun
> Research Associate
>
> Kaiserstraße 12
> Building 05.01
> 76131 Karlsruhe
>
> Phone: +49 721 608-3790
> Fax: +49 721 608-6071
> www.cel.kit.edu
>
> KIT -- University of the State of Baden-Württemberg and
> National Laboratory of the Helmholtz Association
>
> Index: gnuradio-core/src/lib/general/gr_head.h
> ===================================================================
> --- gnuradio-core/src/lib/general/gr_head.h (revision 11663)
> +++ gnuradio-core/src/lib/general/gr_head.h (working copy)
> @@ -38,11 +38,11 @@
>
> class gr_head : public gr_sync_block
> {
> - friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, int nitems);
> - gr_head (size_t sizeof_stream_item, int nitems);
> + friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long
> long nitems);
> + gr_head (size_t sizeof_stream_item, unsigned long long nitems);
>
> - int d_nitems;
> - int d_ncopied_items;
> + unsigned long long d_nitems;
> + unsigned long long d_ncopied_items;
>
> public:
> int work (int noutput_items,
> @@ -53,7 +53,7 @@
> };
>
> gr_head_sptr
> -gr_make_head (size_t sizeof_stream_item, int nitems);
> +gr_make_head (size_t sizeof_stream_item, unsigned long long nitems);
>
>
> #endif /* INCLUDED_GR_HEAD_H */
> Index: gnuradio-core/src/lib/general/gr_head.i
> ===================================================================
> --- gnuradio-core/src/lib/general/gr_head.i (revision 11663)
> +++ gnuradio-core/src/lib/general/gr_head.i (working copy)
> @@ -22,7 +22,7 @@
>
> GR_SWIG_BLOCK_MAGIC(gr,head);
>
> -gr_head_sptr gr_make_head(size_t sizeof_stream_item, int nitems);
> +gr_head_sptr gr_make_head(size_t sizeof_stream_item, unsigned long long
> nitems);
>
> class gr_head : public gr_block {
> gr_head();
> Index: gnuradio-core/src/lib/general/gr_head.cc
> ===================================================================
> --- gnuradio-core/src/lib/general/gr_head.cc (revision 11663)
> +++ gnuradio-core/src/lib/general/gr_head.cc (working copy)
> @@ -27,7 +27,7 @@
> #include <gr_io_signature.h>
> #include <string.h>
>
> -gr_head::gr_head (size_t sizeof_stream_item, int nitems)
> +gr_head::gr_head (size_t sizeof_stream_item, unsigned long long nitems)
> : gr_sync_block ("head",
> gr_make_io_signature (1, 1, sizeof_stream_item),
> gr_make_io_signature (1, 1, sizeof_stream_item)),
> @@ -36,7 +36,7 @@
> }
>
> gr_head_sptr
> -gr_make_head (size_t sizeof_stream_item, int nitems)
> +gr_make_head (size_t sizeof_stream_item, unsigned long long nitems)
> {
> return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item,
> nitems));
> }
> @@ -49,7 +49,7 @@
> if (d_ncopied_items >= d_nitems)
> return -1; // Done!
>
> - unsigned n = std::min (d_nitems - d_ncopied_items, noutput_items);
> + unsigned n = std::min (d_nitems - d_ncopied_items, (unsigned long long)
> noutput_items);
>
> if (n == 0)
> return 0;
> _______________________________________________
> Patch-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/patch-gnuradio