Boundary calculation

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

 



Hello.

I can't get the tricky boundary calculation. Perhaps I'm
missing some obvious thing, or maybe it's really some
circumvent for a specific case that was not commented.

The current calculation for boundary is:

	boundary = buffer_size;
	while (boundary * 2 <= LONG_MAX - buffer_size)
		boundary *= 2;

I've checked out some repositories, specially alsa-driver
in ALSA git, and I realized this calculation exists at
least since 2001. I guess it was Jaroslav who wrote.

Visualization of the calculation (B = buffer_size):

                           LONG_MAX
-------------------------------
\______________/           \__/
     B * 4                  B
\______/
 B * 2
\__/
 B

Why isn't a simpler calculation used instead? e.g.:

	/* closest multiple of buffer size less or equal LONG_MAX */
	boundary = LONG_MAX - LONG_MAX % buffer_size;

                           LONG_MAX
-------------------------------
\__________________________/
           B * 6

Cheers!

	pasquali
_______________________________________________
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