mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 22:22:17 +00:00
Use memcmp for comparing doubles
This commit is contained in:
parent
46fff99fad
commit
c748293ccb
1 changed files with 2 additions and 1 deletions
3
parser.c
3
parser.c
|
@ -167,7 +167,8 @@ static ast_value* parser_const_float(parser_t *parser, double d)
|
|||
size_t i;
|
||||
ast_value *out;
|
||||
for (i = 0; i < vec_size(parser->imm_float); ++i) {
|
||||
if ((double)(parser->imm_float[i]->constval.vfloat) == d)
|
||||
const double compare = parser->imm_float[i]->constval.vfloat;
|
||||
if (memcmp((const void*)&compare, (const void *)&d, sizeof(double)) == 0)
|
||||
return parser->imm_float[i];
|
||||
}
|
||||
out = ast_value_new(parser_ctx(parser), "#IMMEDIATE", TYPE_FLOAT);
|
||||
|
|
Loading…
Reference in a new issue