Rev Author Line No. Line
23 ovan 1 /************************************************************************************
2 This source file is part of the Theora Video Playback Library
3 For latest info, see http://libtheoraplayer.sourceforge.net/
4 *************************************************************************************
5 Copyright (c) 2008-2010 Kresimir Spes (kreso@cateia.com)
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php
8 *************************************************************************************/
9 #include <unistd.h>
10 #include <stdio.h>
11 #include <algorithm>
12 #include <math.h>
13 #include <map>
14 #include "TheoraUtil.h"
15 #include "TheoraException.h"
16  
17 #ifdef _WIN32
18 #include <windows.h>
19 #pragma warning( disable: 4996 ) // MSVC++
20 #endif
21  
22 std::string str(int i)
23 {
24     char s[32];
25     sprintf(s,"%d",i);
26     return std::string(s);
27 }
28  
29 std::string strf(float i)
30 {
31     char s[32];
32     sprintf(s,"%.3f",i);
33     return std::string(s);
34 }
35  
36 void _psleep(int milliseconds)
37 {
38 #ifndef _WIN32
39     usleep(milliseconds*1000);
40 #else
41         Sleep(milliseconds);
42 #endif
43 }
44  
45  
46 int _nextPow2(int x)
47 {
48         int y;
49         for (y=1;y<x;y*=2);
50         return y;
51 }