On 07/03/2013 09:01 PM, Anoop Saldanha wrote:
> In src/util-streaming-parser.c:
> 
>> +{
>> +    StreamingParserCtx *tctx = (StreamingParserCtx *)ctx;
>> +    uint16_t u;
>> +
>> +    if (psize <= tctx->buffer_len) {
>> +        if (psize == 2) {
>> +            *((uint16_t *)ret_input) = tctx->buffer.u16[0];
>> +        } else if (psize == 4) {
>> +            *((uint32_t *)ret_input) = tctx->buffer.u32[0];
>> +        } else {
>> +            *((uint64_t *)ret_input) = tctx->buffer.u64;
>> +        }
>> +        /* Since a type can't be shifted by a value >= width of the type, we
>> +         * need to split it */
>> +        tctx->buffer.u64 >>= (psize * 8 - 1);
>> +        tctx->buffer.u64 >>= 1;
> 
> yeah, but then what you have typed is exactly what i was trying to avoid.

But why? What I did is so much cleaner and more readable.