MythTV
master
mythtv
libs
libmythtv
visualisations
goom
goom_tools.h
Go to the documentation of this file.
1
#ifndef GOOMTOOLS_H
2
#define GOOMTOOLS_H
3
4
#include <cinttypes>
5
#include <cstddef>
6
#include <cstdlib>
7
8
#if !defined( M_PI )
9
static
constexpr
double
M_PI
{ 3.14159265358979323846 };
10
#endif
11
static
constexpr
float
M_PI_F
{
static_cast<
float
>
(
M_PI
) };
12
13
static
constexpr
size_t
NB_RAND
{ 0x10000 };
14
15
/* in graphic.c */
16
extern
int
*
rand_tab
;
17
static
unsigned
short
rand_pos
;
18
19
static
inline
void
RAND_INIT
(
int
i)
20
{
21
srand (i) ;
22
if
(!
rand_tab
)
23
rand_tab
= (
int
*) malloc (
NB_RAND
*
sizeof
(
int
)) ;
24
rand_pos
= 1 ;
25
while
(
rand_pos
!= 0)
26
rand_tab
[
rand_pos
++] = rand () ;
27
}
28
29
static
inline
int
RAND
(
void
)
30
{
31
++
rand_pos
;
32
return
rand_tab
[
rand_pos
];
33
}
34
35
static
inline
void
RAND_CLOSE
()
36
{
37
free(
rand_tab
);
38
rand_tab
=
nullptr
;
39
}
40
41
//#define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX))
42
static
inline
unsigned
int
iRAND
(
int
i)
43
{
return
static_cast<
unsigned
int
>
(
RAND
()) % i; }
44
45
//inline unsigned int RAND(void);
46
//inline unsigned int iRAND(int i);
47
48
#endif // GOOMTOOLS_H
RAND
static int RAND(void)
Definition:
goom_tools.h:29
NB_RAND
static constexpr size_t NB_RAND
Definition:
goom_tools.h:13
M_PI_F
static constexpr float M_PI_F
Definition:
goom_tools.h:11
iRAND
static unsigned int iRAND(int i)
Definition:
goom_tools.h:42
RAND_INIT
static void RAND_INIT(int i)
Definition:
goom_tools.h:19
rand_pos
static unsigned short rand_pos
Definition:
goom_tools.h:17
rand_tab
int * rand_tab
Definition:
graphic.cpp:16
RAND_CLOSE
static void RAND_CLOSE()
Definition:
goom_tools.h:35
M_PI
static constexpr double M_PI
Definition:
goom_tools.h:9
Generated on Thu Feb 6 2025 03:17:19 for MythTV by
1.8.17