Fix left/right shift constant fold.
authorDale Weiler <killfieldengine@gmail.com>
Mon, 17 Mar 2014 13:41:53 +0000 (09:41 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Mon, 17 Mar 2014 13:41:53 +0000 (09:41 -0400)
fold.c

diff --git a/fold.c b/fold.c
index f064f29fa5d599c48dfda5e49342e32aaee3b98b..14665f28c2a7dd37fb093a46cdaee0dd1e618820 100644 (file)
--- a/fold.c
+++ b/fold.c
@@ -550,13 +550,13 @@ static GMQCC_INLINE ast_expression *fold_op_xor(fold_t *fold, ast_value *a, ast_
 
 static GMQCC_INLINE ast_expression *fold_op_lshift(fold_t *fold, ast_value *a, ast_value *b) {
     if (fold_can_2(a, b) && isfloats(a, b))
-        return fold_constgen_float(fold, (qcfloat_t)(((qcuint_t)(floorf(fold_immvalue_float(a) * powf(2.0f, fold_immvalue_float(b))))) & 0xFFFFFF));
+        return fold_constgen_float(fold, (qcfloat_t)(((qcuint_t)(floorf(fold_immvalue_float(a) * powf(2.0f, fold_immvalue_float(b)))))));
     return NULL;
 }
 
 static GMQCC_INLINE ast_expression *fold_op_rshift(fold_t *fold, ast_value *a, ast_value *b) {
     if (fold_can_2(a, b) && isfloats(a, b))
-        return fold_constgen_float(fold, (qcfloat_t)(((qcuint_t)(floorf(fold_immvalue_float(a) / powf(2.0f, fold_immvalue_float(b))))) & 0xFFFFFF));
+        return fold_constgen_float(fold, (qcfloat_t)(((qcuint_t)(floorf(fold_immvalue_float(a) / powf(2.0f, fold_immvalue_float(b)))))));
     return NULL;
 }