mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 10:50:58 +00:00
[util] Add promotion from float to int to cexpr
I won't go the other way nor will I add double to float.
This commit is contained in:
parent
b493e6ac32
commit
0da99bc59c
1 changed files with 8 additions and 0 deletions
|
@ -264,6 +264,13 @@ float_div_quat (const exprval_t *val1, const exprval_t *val2,
|
|||
*c = a * qconjf (b) / dotf (b, b);
|
||||
}
|
||||
|
||||
static void
|
||||
float_cast_int (const exprval_t *val1, const exprval_t *src, exprval_t *result,
|
||||
exprctx_t *ctx)
|
||||
{
|
||||
*(float *) result->value = *(int *) src->value;
|
||||
}
|
||||
|
||||
UNOP(float, pos, float, +)
|
||||
UNOP(float, neg, float, -)
|
||||
UNOP(float, tnot, float, !)
|
||||
|
@ -278,6 +285,7 @@ binop_t float_binops[] = {
|
|||
{ '/', &cexpr_quaternion, &cexpr_quaternion, float_div_quat },
|
||||
{ '%', &cexpr_float, &cexpr_float, float_rem },
|
||||
{ MOD, &cexpr_float, &cexpr_float, float_mod },
|
||||
{ '=', &cexpr_int, &cexpr_float, float_cast_int },
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue