Re: [PATCH] Sample generation on big endian platforms was broken.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Fri, 03 Jul 2009 17:11:37 +0200,
Kenneth Johansson wrote:
> 
> On Fri, 2009-07-03 at 17:00 +0200, Takashi Iwai wrote:
> > At Fri, 03 Jul 2009 16:51:35 +0200,
> > Kenneth Johansson wrote:
> > > 
> > > On Fri, 2009-07-03 at 16:39 +0200, Takashi Iwai wrote:
> > > > At Fri, 03 Jul 2009 16:19:31 +0200,
> > > > Kenneth Johansson wrote:
> > > > > 
> > > > > Has not worked since commit 3d1fa924906996463ac33cba5b5143f762d913cf
> > > > > 
> > > > > Signed-off-by: Kenneth Johansson <kenneth@xxxxxxxxxxxx>
> > > > 
> > > > Hrm, sorry, but your version is also broken as doing type-punning.
> > > > The code has to be rewritten completely...
> > > > 
> > > > 
> > > > Takashi
> > > 
> > > hmm I think you have to explain this. now it works on both little/big
> > > endian without any explicit byte moves.
> > > 
> > > It did not understand what problem you see.
> > 
> > You can't cast from a char pointer to another type (e.g. short) and
> > read the value.  This is called "type-punning" and doesn't work
> > properly with the recent GCC (depending on the optimization and
> > code parsing) since it handles strict-aliasing.
> > 
> > See GCC info for details.
> > 
> > 
> > Takashi
> 
> But there is no aliasing problem in that code. The memory is only
> accessed(written in this case) using one type.

One type?

+			switch(bps){
+			case 1:
+				*(samples[chn]) = res;
+				break;
+			case 2:
+				*(short*)(samples[chn]) = res;
+				break;
+			case 4:
+				*(int*)(samples[chn]) = res;
+			}
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux