* Suspecting a bug in plugin_ops.h
@ 2011-05-26 13:19 Soulard, MathieuX
2011-05-26 14:53 ` Clemens Ladisch
0 siblings, 1 reply; 3+ messages in thread
From: Soulard, MathieuX @ 2011-05-26 13:19 UTC (permalink / raw)
To: alsa-devel
Hi all,
I'm using alsalib and I checked its code because of one issue I have.
I did not yet solved my issue, but I think I saw a bug in alsa-lib that I would like to share with you.
It is located in [alsa-lib]/src/pcm/plugin_ops.h in the inline function sx24s().
static inline u_int32_t sx24s(u_int32_t x)
{
if(x&0x00008000)
return x|0x000000FF;
return x&0xFFFFFF00;
}
I think that 0x00008000 should be replaced by 0x00000800.
Thanks
Regards
Mathieu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Suspecting a bug in plugin_ops.h
2011-05-26 13:19 Suspecting a bug in plugin_ops.h Soulard, MathieuX
@ 2011-05-26 14:53 ` Clemens Ladisch
2011-05-27 7:41 ` Soulard, MathieuX
0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2011-05-26 14:53 UTC (permalink / raw)
To: Soulard, MathieuX; +Cc: alsa-devel
Soulard, MathieuX wrote:
> static inline u_int32_t sx24s(u_int32_t x)
> {
> if(x&0x00008000)
> return x|0x000000FF;
> return x&0xFFFFFF00;
> }
>
> I think that 0x00008000 should be replaced by 0x00000800.
This function is indented to sign-extended a 24-bit value to 32 bits,
operating in 'wrong' endianness.
Why do you think that the sign bit is in the highest bit of the second-
highest nibble?
Regards,
Clemens
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Suspecting a bug in plugin_ops.h
2011-05-26 14:53 ` Clemens Ladisch
@ 2011-05-27 7:41 ` Soulard, MathieuX
0 siblings, 0 replies; 3+ messages in thread
From: Soulard, MathieuX @ 2011-05-27 7:41 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel
> > static inline u_int32_t sx24s(u_int32_t x)
> > {
> > if(x&0x00008000)
> > return x|0x000000FF;
> > return x&0xFFFFFF00;
> > }
> >
> > I think that 0x00008000 should be replaced by 0x00000800.
>
> This function is indented to sign-extended a 24-bit value to 32 bits,
> operating in 'wrong' endianness.
>
> Why do you think that the sign bit is in the highest bit of the second-
> highest nibble?
Well... because I think I made a mistake !
Actually I missed the endianness here, I thought about another format.
Thanks for your prompt response.
Thanks
Regards
Mathieu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-27 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 13:19 Suspecting a bug in plugin_ops.h Soulard, MathieuX
2011-05-26 14:53 ` Clemens Ladisch
2011-05-27 7:41 ` Soulard, MathieuX
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.