Vuo
2.0.1
type
VuoInteger.h
Go to the documentation of this file.
1
10
#pragma once
11
12
#ifdef __cplusplus
13
extern
"C"
{
14
#endif
15
16
#include <stdint.h>
17
#include <stdbool.h>
18
#include <math.h>
19
struct
json_object
;
20
32
typedef
int64_t
VuoInteger
;
33
34
VuoInteger
VuoInteger_makeFromJson
(
struct
json_object
* js);
35
struct
json_object
*
VuoInteger_getJson
(
const
VuoInteger
value);
36
char
*
VuoInteger_getSummary
(
const
VuoInteger
value);
37
38
VuoInteger
VuoInteger_min
(
VuoInteger
*terms,
unsigned
long
termsCount,
VuoInteger
*outputPosition);
39
VuoInteger
VuoInteger_max
(
VuoInteger
*terms,
unsigned
long
termsCount,
VuoInteger
*outputPosition);
40
41
VuoInteger
VuoInteger_wrap
(
VuoInteger
value,
VuoInteger
minimum,
VuoInteger
maximum);
42
43
VuoInteger
VuoInteger_random
(
const
VuoInteger
minimum,
const
VuoInteger
maximum);
44
45
void
VuoInteger_setRandomState
(
unsigned
short
state[3],
const
VuoInteger
seed);
46
VuoInteger
VuoInteger_randomWithState
(
unsigned
short
state[3],
const
VuoInteger
minimum,
const
VuoInteger
maximum);
47
48
VuoInteger
VuoInteger_makeFromHexByte
(
unsigned
char
byte
);
49
55
static
inline
VuoInteger
VuoInteger_add
(
VuoInteger
a,
VuoInteger
b)
__attribute__
((
const
));
56
static
inline
VuoInteger
VuoInteger_add
(
VuoInteger
a,
VuoInteger
b)
57
{
58
return
a+b;
59
}
60
66
static
inline
VuoInteger
VuoInteger_subtract
(
VuoInteger
a,
VuoInteger
b)
__attribute__
((
const
));
67
static
inline
VuoInteger
VuoInteger_subtract
(
VuoInteger
a,
VuoInteger
b)
68
{
69
return
a-b;
70
}
71
75
static
inline
VuoInteger
VuoInteger_multiply
(
VuoInteger
a,
VuoInteger
b)
__attribute__
((
const
));
76
static
inline
VuoInteger
VuoInteger_multiply
(
VuoInteger
a,
VuoInteger
b)
77
{
78
return
a*b;
79
}
80
84
static
inline
VuoInteger
VuoInteger_scale
(
VuoInteger
a,
VuoInteger
b)
__attribute__
((
const
));
85
static
inline
VuoInteger
VuoInteger_scale
(
VuoInteger
a,
VuoInteger
b)
86
{
87
return
a*b;
88
}
89
93
static
inline
VuoInteger
VuoInteger_makeNonzero
(
VuoInteger
a)
__attribute__
((
const
));
94
static
inline
VuoInteger
VuoInteger_makeNonzero
(
VuoInteger
a)
95
{
96
return
a ? a : 1;
97
}
98
102
static
inline
VuoInteger
VuoInteger_snap
(
VuoInteger
a,
VuoInteger
center,
VuoInteger
snap)
__attribute__
((
const
));
103
static
inline
VuoInteger
VuoInteger_snap
(
VuoInteger
a,
VuoInteger
center,
VuoInteger
snap)
104
{
105
if
(snap == 0)
106
return
a;
107
return
center + snap * ((a-center) / snap);
108
}
109
111
#define VuoInteger_SUPPORTS_COMPARISON
112
bool
VuoInteger_areEqual
(
const
VuoInteger
value1,
const
VuoInteger
value2);
113
bool
VuoInteger_isLessThan
(
const
VuoInteger
a,
const
VuoInteger
b);
114
115
#ifndef MIN
116
119
#define MIN(a,b) (((a)<(b))?(a):(b))
120
#endif
121
122
#ifndef MAX
123
126
#define MAX(a,b) (((a)>(b))?(a):(b))
127
#endif
128
132
static
inline
VuoInteger
VuoInteger_clamp
(
VuoInteger
value,
VuoInteger
limitA,
VuoInteger
limitB)
133
{
134
return
MIN
(
MAX
(value,
MIN
(limitA, limitB)),
MAX
(limitA,limitB));
135
}
136
141
static
inline
VuoInteger
VuoInteger_clampn
(
VuoInteger
value,
VuoInteger
limitA,
VuoInteger
limitB)
142
{
143
return
VuoInteger_clamp
(value, limitA, limitB);
144
}
145
147
150
VuoInteger
VuoInteger_makeFromString
(
const
char
*str);
151
char
*
VuoInteger_getString
(
const
VuoInteger
value);
152
void
VuoInteger_retain
(
VuoInteger
value);
153
void
VuoInteger_release
(
VuoInteger
value);
155
160
#ifdef __cplusplus
161
}
162
#endif
Generated on Sat Mar 14 2020 13:04:38 for Vuo by
1.8.17