Change in osmo-trx[master]: radioInterfaceMulti:pullBuffer: Sanely convert float array to complex...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Sep 10 15:31:02 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/10720 )

Change subject: radioInterfaceMulti:pullBuffer: Sanely convert float array to complex array
......................................................................

radioInterfaceMulti:pullBuffer: Sanely convert float array to complex array

Fixes this type of compilation warning:
‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class Complex<float>’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]

Change-Id: Ibb2380a0a335ce798fe87221519fbbebade53054
---
M Transceiver52M/radioInterfaceMulti.cpp
1 file changed, 16 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/Transceiver52M/radioInterfaceMulti.cpp b/Transceiver52M/radioInterfaceMulti.cpp
index 67ccb25..17a015b 100644
--- a/Transceiver52M/radioInterfaceMulti.cpp
+++ b/Transceiver52M/radioInterfaceMulti.cpp
@@ -230,6 +230,7 @@
 	bool local_underrun;
 	size_t num;
 	float *buf;
+	unsigned int i;
 
 	if (recvBuffer[0]->getFreeSegments() <= 0)
 		return -1;
@@ -273,10 +274,22 @@
 		buf = channelizer->outputBuffer(pchan);
 		size_t cLen = channelizer->outputLen();
 		size_t hLen = dnsampler->len();
-		size_t hSize = 2 * hLen * sizeof(float);
 
-		memcpy(&buf[2 * -hLen], history[lchan]->begin(), hSize);
-		memcpy(history[lchan]->begin(), &buf[2 * (cLen - hLen)], hSize);
+		float *fdst = &buf[2 * -hLen];
+		complex *src = history[lchan]->begin();
+		for (i = 0; i < hLen; i++) {
+			fdst[0] = src->real();
+			fdst[1] = src->imag();
+			src++;
+			fdst += 2;
+		}
+		complex *dst = history[lchan]->begin();
+		float *fsrc = &buf[2 * (cLen - hLen)];
+		for (i = 0; i < hLen; i++) {
+			*dst = complex(fdst[0], fdst[1]);
+			fsrc += 2;
+			dst++;
+		}
 
 		float *wr_segment = recvBuffer[lchan]->getWriteSegment();
 

-- 
To view, visit https://gerrit.osmocom.org/10720
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb2380a0a335ce798fe87221519fbbebade53054
Gerrit-Change-Number: 10720
Gerrit-PatchSet: 3
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180910/7eab5373/attachment.htm>


More information about the gerrit-log mailing list