<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 1:</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 1:</p><p style="white-space: pre-wrap; word-wrap: break-word;">I'm not convinced (yet).  Normally, we pass values around in host byte order and only translate them to network byte order when generating messages.</p><p style="white-space: pre-wrap; word-wrap: break-word;">So why is that value already in netwokr byte order? Why can the caller not provide it in host byte order?</p><p style="white-space: pre-wrap; word-wrap: break-word;">Also, if we really want function arguments are not in native (host) byte order, I think it must clearly be documented in the doxygen part.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Hmm. I have checked it multiple times now. Network byte order is big endien, x86er is little endien. However 3GPP TS 48.008, section 3.2.2.105 wants the least significant byte transmitted first. I think thats why the endieness should already match the host byte order here.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Thanks for pointing this out.  That's of course quite unusual (probably a bug in the spec that was only discovered when it was too late and now everyone has to send little-endian uint32_t in a protocol that otherwise is always big-endian).</p><p style="white-space: pre-wrap; word-wrap: break-word;">But even in that case your patch is wrong.  You need to do a portable conversion from host endianness (which can be either little or big) to little-endian.  This conversion is so uncommon that we don't even have a libosmocore function for it.  In the kernel there are macros like cpu_to_le32(x), but we don't have that.  I guess you have to #include osmocom/core/endian.h and then  do an #ifndef  OSMO_IS_LITTLE_ENDIAN #else #endif clause. If the host is not LITTLE_ENDIAN, you need to do an osmo_swab32(). If the host is little endian, then nothing.</p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/18694">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/18694">change 18694</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/18694"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I6468e502f552f99ab54aec9d4b1c169fdc0adfb8 </div>
<div style="display:none"> Gerrit-Change-Number: 18694 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 05 Jun 2020 20:52:25 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>