[pulseaudio-commits] r1684 - in /branches/lennart/src/pulsecore: core-util.c core-util.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Tue Aug 21 17:20:14 PDT 2007
Author: lennart
Date: Wed Aug 22 02:20:13 2007
New Revision: 1684
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1684&root=3Dpulseaudio&vi=
ew=3Drev
Log:
add pa_is_power_of_two() and pa_make_power_of_two() functions
Modified:
branches/lennart/src/pulsecore/core-util.c
branches/lennart/src/pulsecore/core-util.h
Modified: branches/lennart/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core-util.c?rev=3D1684&root=3Dpulseaudio&r1=3D1683&r2=3D1684&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core-util.c (original)
+++ branches/lennart/src/pulsecore/core-util.c Wed Aug 22 02:20:13 2007
@@ -1208,3 +1208,21 @@
=
return c;
}
+
+int pa_is_power_of_two(unsigned n) {
+ return !(n & (n - 1));
+}
+
+unsigned pa_make_power_of_two(unsigned n) {
+ unsigned j =3D n;
+
+ if (pa_is_power_of_two(n))
+ return n;
+ =
+ while (j) {
+ j =3D j >> 1;
+ n =3D n | j;
+ }
+
+ return n + 1;
+}
Modified: branches/lennart/src/pulsecore/core-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core-util.h?rev=3D1684&root=3Dpulseaudio&r1=3D1683&r2=3D1684&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core-util.h (original)
+++ branches/lennart/src/pulsecore/core-util.h Wed Aug 22 02:20:13 2007
@@ -97,4 +97,7 @@
=
char *pa_truncate_utf8(char *c, size_t l);
=
+int pa_is_power_of_two(unsigned n);
+unsigned pa_make_power_of_two(unsigned n);
+
#endif
More information about the pulseaudio-commits
mailing list