summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/add_const_bb_impl.cc
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2019-08-07 21:45:12 +0200
committerMarcus Müller <marcus@hostalia.de>2019-08-09 23:04:28 +0200
commitf7bbf2c1d8d780294f3e016aff239ca35eb6516e (patch)
treee09ab6112e02b2215b2d59ac24d3d6ea2edac745 /gr-blocks/lib/add_const_bb_impl.cc
parent78431dc6941e3acc67c858277dfe4a0ed583643c (diff)
Tree: clang-format without the include sorting
Diffstat (limited to 'gr-blocks/lib/add_const_bb_impl.cc')
-rw-r--r--gr-blocks/lib/add_const_bb_impl.cc125
1 files changed, 62 insertions, 63 deletions
diff --git a/gr-blocks/lib/add_const_bb_impl.cc b/gr-blocks/lib/add_const_bb_impl.cc
index 8f225d6e68..1ac9aff4ba 100644
--- a/gr-blocks/lib/add_const_bb_impl.cc
+++ b/gr-blocks/lib/add_const_bb_impl.cc
@@ -28,80 +28,79 @@
#include <gnuradio/io_signature.h>
namespace gr {
- namespace blocks {
+namespace blocks {
- add_const_bb::sptr add_const_bb::make(unsigned char k)
- {
- return gnuradio::get_initial_sptr
- (new add_const_bb_impl(k));
- }
-
- add_const_bb_impl::add_const_bb_impl(unsigned char k)
- : sync_block("add_const_bb",
- io_signature::make (1, 1, sizeof(unsigned char)),
- io_signature::make (1, 1, sizeof(unsigned char))),
- d_k(k)
- {
- }
+add_const_bb::sptr add_const_bb::make(unsigned char k)
+{
+ return gnuradio::get_initial_sptr(new add_const_bb_impl(k));
+}
- add_const_bb_impl::~add_const_bb_impl()
- {
- }
+add_const_bb_impl::add_const_bb_impl(unsigned char k)
+ : sync_block("add_const_bb",
+ io_signature::make(1, 1, sizeof(unsigned char)),
+ io_signature::make(1, 1, sizeof(unsigned char))),
+ d_k(k)
+{
+}
- int
- add_const_bb_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const unsigned char *iptr = (const unsigned char *) input_items[0];
- unsigned char *optr = (unsigned char *) output_items[0];
+add_const_bb_impl::~add_const_bb_impl() {}
- int size = noutput_items;
+int add_const_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items)
+{
+ const unsigned char* iptr = (const unsigned char*)input_items[0];
+ unsigned char* optr = (unsigned char*)output_items[0];
- while(size >= 8) {
- *optr++ = *iptr++ + d_k;
- *optr++ = *iptr++ + d_k;
- *optr++ = *iptr++ + d_k;
- *optr++ = *iptr++ + d_k;
- *optr++ = *iptr++ + d_k;
- *optr++ = *iptr++ + d_k;
- *optr++ = *iptr++ + d_k;
- *optr++ = *iptr++ + d_k;
- size -= 8;
- }
+ int size = noutput_items;
- while(size-- > 0) {
- *optr++ = *iptr++ + d_k;
- }
+ while (size >= 8) {
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ size -= 8;
+ }
- return noutput_items;
+ while (size-- > 0) {
+ *optr++ = *iptr++ + d_k;
}
- void
- add_const_bb_impl::setup_rpc()
- {
+ return noutput_items;
+}
+
+void add_const_bb_impl::setup_rpc()
+{
#ifdef GR_CTRLPORT
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_get<add_const_bb, unsigned char>(
- alias(), "Constant",
- &add_const_bb::k,
- pmt::from_long(-128),
- pmt::from_long(127),
- pmt::from_long(0),
- "", "Constant to add", RPC_PRIVLVL_MIN,
- DISPTIME | DISPOPTCPLX | DISPOPTSTRIP)));
+ add_rpc_variable(rpcbasic_sptr(new rpcbasic_register_get<add_const_bb, unsigned char>(
+ alias(),
+ "Constant",
+ &add_const_bb::k,
+ pmt::from_long(-128),
+ pmt::from_long(127),
+ pmt::from_long(0),
+ "",
+ "Constant to add",
+ RPC_PRIVLVL_MIN,
+ DISPTIME | DISPOPTCPLX | DISPOPTSTRIP)));
- add_rpc_variable(
- rpcbasic_sptr(new rpcbasic_register_set<add_const_bb, unsigned char>(
- alias(), "Constant",
- &add_const_bb::set_k,
- pmt::from_long(-128),
- pmt::from_long(127),
- pmt::from_long(0),
- "", "Constant to add",
- RPC_PRIVLVL_MIN, DISPNULL)));
+ add_rpc_variable(rpcbasic_sptr(
+ new rpcbasic_register_set<add_const_bb, unsigned char>(alias(),
+ "Constant",
+ &add_const_bb::set_k,
+ pmt::from_long(-128),
+ pmt::from_long(127),
+ pmt::from_long(0),
+ "",
+ "Constant to add",
+ RPC_PRIVLVL_MIN,
+ DISPNULL)));
#endif /* GR_CTRLPORT */
- }
+}
- } /* namespace blocks */
+} /* namespace blocks */
} /* namespace gr */