server/src/util/variant.h
Enno Rehling 234eb62226 short and sweet math with fractions.
goinf to use this for magres.
2017-02-24 17:51:35 +01:00

32 lines
585 B
C

#pragma once
#ifndef STRUCT_VARIANT_H
#define STRUCT_VARIANT_H
#ifdef __cplusplus
extern "C" {
#endif
typedef union variant {
void *v;
int i;
char c;
short s;
short sa[2];
char ca[4];
float f;
} variant;
typedef enum variant_type {
VAR_NONE, VAR_INT, VAR_VOIDPTR, VAR_CHAR, VAR_SHORT, VAR_SHORTA, VAR_CHARA,
VAR_FLOAT
} variant_type;
variant frac_make(int num, int den);
variant frac_add(variant a, variant b);
variant frac_mul(variant a, variant b);
variant frac_div(variant a, variant b);
#ifdef __cplusplus
}
#endif
#endif