Vuo
2.2.1
|
A signed 64-bit integer.
Classes | |
struct | VuoList_VuoInteger_struct |
List type. More... | |
Macros | |
#define | VuoList_VuoInteger_TYPE_DEFINED |
List type. More... | |
#define | VuoInteger_SUPPORTS_COMPARISON |
This type has _areEqual() and _isLessThan() functions. More... | |
#define | MIN(a, b) (((a)<(b))?(a):(b)) |
Returns the smaller of a and b . More... | |
#define | MAX(a, b) (((a)>(b))?(a):(b)) |
Returns the larger of a and b . More... | |
Typedefs | |
typedef int64_t | VuoInteger |
A signed 64-bit integer. More... | |
typedef const struct VuoList_VuoInteger_struct * | VuoList_VuoInteger |
List type. More... | |
Functions | |
VuoInteger | VuoInteger_makeFromJson (json_object *js) |
Decodes the JSON object js to create a new value. More... | |
json_object * | VuoInteger_getJson (const VuoInteger value) |
Encodes value as a JSON object. More... | |
char * | VuoInteger_getSummary (const VuoInteger value) |
Always shows the full value, since it's guaranteed to be pretty short. More... | |
VuoInteger | VuoInteger_minList (VuoList_VuoInteger values, VuoInteger *outputPosition) |
Returns the minimum of a list of terms, or 0 if the array is empty. More... | |
VuoInteger | VuoInteger_maxList (VuoList_VuoInteger values, VuoInteger *outputPosition) |
Returns the maximum of a list of terms, or 0 if the array is empty. More... | |
VuoInteger | VuoInteger_average (VuoList_VuoInteger values) |
Returns the average of the values in the list, or 0 if the list is empty. More... | |
VuoInteger | VuoInteger_wrap (VuoInteger value, VuoInteger minimum, VuoInteger maximum) |
Returns value if it is within the range of minimum to maximum (inclusive), otherwise a value wrapped with modular arithmetic to be within the range. More... | |
VuoInteger | VuoInteger_random (const VuoInteger minimum, const VuoInteger maximum) |
Returns a pseudorandom value between minimum and maximum , inclusive. More... | |
void | VuoInteger_setRandomState (unsigned short state[3], const VuoInteger seed) |
Initializes state using the lower 48 bits of seed . More... | |
VuoInteger | VuoInteger_randomWithState (unsigned short state[3], const VuoInteger minimum, const VuoInteger maximum) |
Returns a pseudorandom value between minimum and maximum , inclusive. More... | |
VuoInteger | VuoInteger_makeFromHexByte (unsigned char byte) |
If byte is a valid ASCII hex character (0–9, a–f, A–F), returns the equivalent numeric value. More... | |
static VuoInteger | VuoInteger_add (VuoInteger a, VuoInteger b) __attribute__((const)) |
a+b More... | |
static VuoInteger | VuoInteger_subtract (VuoInteger a, VuoInteger b) __attribute__((const)) |
a-b More... | |
static VuoInteger | VuoInteger_multiply (VuoInteger a, VuoInteger b) __attribute__((const)) |
Provided for generic type equivalence with VuoPoints. More... | |
static VuoInteger | VuoInteger_scale (VuoInteger a, VuoInteger b) __attribute__((const)) |
Provided for generic type equivalence with VuoPoints. More... | |
static VuoInteger | VuoInteger_divide (VuoInteger a, VuoInteger b) __attribute__((const)) |
a/b More... | |
static VuoInteger | VuoInteger_makeNonzero (VuoInteger a) __attribute__((const)) |
If the value is zero, returns 1. More... | |
static VuoInteger | VuoInteger_snap (VuoInteger a, VuoInteger center, VuoInteger snap) __attribute__((const)) |
Returns a snapped value using a center point and snap value. More... | |
bool | VuoInteger_areEqual (const VuoInteger value1, const VuoInteger value2) |
Returns true if the two values are equal. More... | |
bool | VuoInteger_areEqualListWithinTolerance (VuoList_VuoInteger values, VuoInteger tolerance) |
Returns true if the two values are equal within tolerance . More... | |
bool | VuoInteger_isLessThan (const VuoInteger a, const VuoInteger b) |
Returns true if a < b. More... | |
bool | VuoInteger_isWithinRange (VuoInteger value, VuoInteger minimum, VuoInteger maximum) |
Returns true if value is between minimum and maximum . More... | |
static VuoInteger | VuoInteger_clamp (VuoInteger value, VuoInteger limitA, VuoInteger limitB) |
Limits value to values between min and max , inclusive. More... | |
static VuoInteger | VuoInteger_clampn (VuoInteger value, VuoInteger limitA, VuoInteger limitB) |
Same as VuoInteger_clamp. More... | |
VuoInteger | VuoInteger_makeFromString (const char *str) |
Automatically generated function. More... | |
char * | VuoInteger_getString (const VuoInteger value) |
Automatically generated function. More... | |
void | VuoInteger_retain (VuoInteger value) |
Automatically generated function. More... | |
void | VuoInteger_release (VuoInteger value) |
Automatically generated function. More... | |
#define MAX | ( | a, | |
b | |||
) | (((a)>(b))?(a):(b)) |
Returns the larger of a
and b
.
Definition at line 145 of file VuoInteger.h.
#define MIN | ( | a, | |
b | |||
) | (((a)<(b))?(a):(b)) |
Returns the smaller of a
and b
.
Definition at line 138 of file VuoInteger.h.
#define VuoInteger_SUPPORTS_COMPARISON |
This type has _areEqual() and _isLessThan() functions.
Definition at line 128 of file VuoInteger.h.
#define VuoList_VuoInteger_TYPE_DEFINED |
List type.
Definition at line 37 of file VuoInteger.h.
typedef int64_t VuoInteger |
A signed 64-bit integer.
Definition at line 32 of file VuoInteger.h.
typedef const struct VuoList_VuoInteger_struct * VuoList_VuoInteger |
List type.
|
inlinestatic |
a+b
Provided for generic type equivalence with VuoPoints.
Definition at line 62 of file VuoInteger.h.
bool VuoInteger_areEqual | ( | const VuoInteger | value1, |
const VuoInteger | value2 | ||
) |
Returns true if the two values are equal.
Definition at line 309 of file VuoInteger.c.
bool VuoInteger_areEqualListWithinTolerance | ( | VuoList_VuoInteger | values, |
VuoInteger | tolerance | ||
) |
Returns true if the two values are equal within tolerance
.
Definition at line 317 of file VuoInteger.c.
VuoInteger VuoInteger_average | ( | VuoList_VuoInteger | values | ) |
Returns the average of the values in the list, or 0 if the list is empty.
Definition at line 126 of file VuoInteger.c.
|
inlinestatic |
Limits value
to values between min
and max
, inclusive.
Definition at line 151 of file VuoInteger.h.
|
inlinestatic |
Same as VuoInteger_clamp.
Provided for generic type compatibility with other _clampn
functions.
Definition at line 160 of file VuoInteger.h.
|
inlinestatic |
a/b
Provided for generic type equivalence with VuoPoints.
Definition at line 102 of file VuoInteger.h.
struct json_object * VuoInteger_getJson | ( | const VuoInteger | value | ) |
Encodes value
as a JSON object.
Definition at line 58 of file VuoInteger.c.
char* VuoInteger_getString | ( | const VuoInteger | value | ) |
Automatically generated function.
char * VuoInteger_getSummary | ( | const VuoInteger | value | ) |
Always shows the full value, since it's guaranteed to be pretty short.
Definition at line 67 of file VuoInteger.c.
bool VuoInteger_isLessThan | ( | const VuoInteger | a, |
const VuoInteger | b | ||
) |
Returns true if a < b.
Definition at line 337 of file VuoInteger.c.
bool VuoInteger_isWithinRange | ( | VuoInteger | value, |
VuoInteger | minimum, | ||
VuoInteger | maximum | ||
) |
Returns true if value
is between minimum
and maximum
.
Definition at line 345 of file VuoInteger.c.
VuoInteger VuoInteger_makeFromHexByte | ( | unsigned char | byte | ) |
If byte
is a valid ASCII hex character (0–9, a–f, A–F), returns the equivalent numeric value.
Otherwise returns 0.
Definition at line 301 of file VuoInteger.c.
VuoInteger VuoInteger_makeFromJson | ( | json_object * | js | ) |
Decodes the JSON object js
to create a new value.
Definition at line 32 of file VuoInteger.c.
VuoInteger VuoInteger_makeFromString | ( | const char * | str | ) |
Automatically generated function.
|
inlinestatic |
If the value is zero, returns 1.
Otherwise returns the value.
Definition at line 111 of file VuoInteger.h.
VuoInteger VuoInteger_maxList | ( | VuoList_VuoInteger | values, |
VuoInteger * | outputPosition | ||
) |
Returns the maximum of a list of terms, or 0 if the array is empty.
Definition at line 102 of file VuoInteger.c.
VuoInteger VuoInteger_minList | ( | VuoList_VuoInteger | values, |
VuoInteger * | outputPosition | ||
) |
Returns the minimum of a list of terms, or 0 if the array is empty.
Definition at line 78 of file VuoInteger.c.
|
inlinestatic |
Provided for generic type equivalence with VuoPoints.
Definition at line 82 of file VuoInteger.h.
VuoInteger VuoInteger_random | ( | const VuoInteger | minimum, |
const VuoInteger | maximum | ||
) |
Returns a pseudorandom value between minimum
and maximum
, inclusive.
This function uses arc4random_uniform()
(the key stream generator employed by the arc4 cipher). It is self-seeding.
Both maximum
and maximum - minimum
must be INT_MAX
(2^31) or less.
Definition at line 221 of file VuoInteger.c.
VuoInteger VuoInteger_randomWithState | ( | unsigned short | state[3], |
const VuoInteger | minimum, | ||
const VuoInteger | maximum | ||
) |
Returns a pseudorandom value between minimum
and maximum
, inclusive.
This function uses jrand48()
(a linear congruential algorithm).
Seed it by providing 3 x 16-bit values to state
, which is modified upon return. Pass the modified state
back to this function to retrieve the next value in the sequence.
Both maximum
and maximum - minimum
must be INT_MAX
(2^31) or less.
Definition at line 252 of file VuoInteger.c.
void VuoInteger_release | ( | VuoInteger | value | ) |
Automatically generated function.
void VuoInteger_retain | ( | VuoInteger | value | ) |
Automatically generated function.
|
inlinestatic |
Provided for generic type equivalence with VuoPoints.
Definition at line 91 of file VuoInteger.h.
void VuoInteger_setRandomState | ( | unsigned short | state[3], |
const VuoInteger | seed | ||
) |
Initializes state
using the lower 48 bits of seed
.
Definition at line 235 of file VuoInteger.c.
|
inlinestatic |
Returns a snapped value using a center point and snap value.
Definition at line 120 of file VuoInteger.h.
|
inlinestatic |
a-b
Provided for generic type equivalence with VuoPoints.
Definition at line 73 of file VuoInteger.h.
VuoInteger VuoInteger_wrap | ( | VuoInteger | value, |
VuoInteger | minimum, | ||
VuoInteger | maximum | ||
) |
Returns value if it is within the range of minimum to maximum (inclusive), otherwise a value wrapped with modular arithmetic to be within the range.
Definition at line 143 of file VuoInteger.c.