From 219f2f26dace90ca9971b3ccf6bac20bbadd2be1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 20 Aug 2024 15:16:25 +0900 Subject: [PATCH] [qfcc] Add is_double_val check I wound up not using it, but I'll probably want it eventually.. --- tools/qfcc/include/expr.h | 1 + tools/qfcc/source/expr.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index c3db31d06..16145100a 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -808,6 +808,7 @@ int is_quaternion_val (const expr_t *e) __attribute__((pure)); int is_int_val (const expr_t *e) __attribute__((pure)); int is_uint_val (const expr_t *e) __attribute__((pure)); int is_short_val (const expr_t *e) __attribute__((pure)); +int is_double_val (const expr_t *e) __attribute__((pure)); int is_integral_val (const expr_t *e) __attribute__((pure)); int is_pointer_val (const expr_t *e) __attribute__((pure)); int is_math_val (const expr_t *e) __attribute__((pure)); diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 9006689cb..57ec506a9 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -966,7 +966,20 @@ is_float_val (const expr_t *e) if (e->type == ex_value && e->value->lltype == ev_float) return 1; if (e->type == ex_symbol && e->symbol->sy_type == sy_const - && e->symbol->type->type == ev_float) + && is_float (e->symbol->type)) + return 1; + return 0; +} + +int +is_double_val (const expr_t *e) +{ + if (e->type == ex_nil) + return 1; + if (e->type == ex_value && e->value->lltype == ev_double) + return 1; + if (e->type == ex_symbol && e->symbol->sy_type == sy_const + && is_double (e->symbol->type)) return 1; return 0; }