[PATCH] Add generic LE/BE load/store uint type convertors and use them in msgb

Max.Suraev at fairwaves.ru
Wed Feb 5 12:13:15 UTC 2014


Thanks for comment, I'll try to address them in next version. Could you comment on
the 2nd patch as well?

05.02.2014 10:00, Holger Hans Peter Freyther пишет:
> On Fri, Jan 31, 2014 at 03:10:48PM +0100, ☎ wrote:
>> v3 attached, comments are inline.
> 
>>> this is not lisp.
>>
>> Yepp, that makes me sad too :)
>> Anyway, fixed.
> 
> hmm.. another lisp comment.
> 
>> +/* Load unaligned 16-bit integer (little-endian encoding) */
>> +static inline uint16_t osmo_load16le(const uint8_t *p)
>> +{
>> +	return ((uint16_t)p[0]) | ((uint16_t)p[1] << 8);
>> +}
> 
> do you really need to cast both of them to uint16_t? isn't the
> result enough?
> 
>> +/* Store unaligned 16-bit integer (little-endian encoding) */
>> +static inline void osmo_store16le(uint16_t a, uint8_t *p)
>> +{
>> +	((uint8_t *)p)[0] = (a) & 0xFF;
>> +	((uint8_t *)p)[1] = (a >> 8) & 0xFF;
>> +}
> 
> these and the below uint8_t casts are not needed for sure.
> p is already a uint8_t *. No need to write it down?
> 
> 
> sorry. I try to integrate v4 more quickly. :}
> 


-- 
best regards,
Max, http://fairwaves.ru




More information about the baseband-devel mailing list