[vlc-commits] commit: OpenGL: use clz() ( Rémi Denis-Courmont )
git at videolan.org
git at videolan.org
Sat Nov 13 17:48:11 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 13 18:47:44 2010 +0200| [b9a7045b5126535b46d4afb94329e5d38c260467] | committer: Rémi Denis-Courmont
OpenGL: use clz()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b9a7045b5126535b46d4afb94329e5d38c260467
---
modules/video_output/opengl.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index e7ea1ab..d66eaec 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -93,14 +93,11 @@
# define VLCGL_TYPE VLCGL_RGB_TYPE
#endif
-static inline int GetAlignedSize(int i_size)
+static inline int GetAlignedSize(unsigned size)
{
- /* Return the nearest power of 2 */
- int i_result = 1;
- while(i_result < i_size)
- i_result *= 2;
-
- return i_result;
+ /* Return the smallest larger or equal power of 2 */
+ unsigned align = 1 << (8 * sizeof (unsigned) - clz(size));
+ return ((align >> 1) == size) ? size : align;
}
int vout_display_opengl_Init(vout_display_opengl_t *vgl,
More information about the vlc-commits
mailing list