Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: third_party/yasm/patched-yasm/libyasm/value.c

Issue 6170009: Update our yasm copy to yasm 1.1.0 (Part 1: yasm side)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/yasm/patched-yasm/libyasm/value.c
===================================================================
--- third_party/yasm/patched-yasm/libyasm/value.c (revision 71129)
+++ third_party/yasm/patched-yasm/libyasm/value.c (working copy)
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "util.h"
-/*@unused@*/ RCSID("$Id: value.c 2064 2008-04-14 01:48:02Z peter $");
+/*@unused@*/ RCSID("$Id: value.c 2220 2009-07-24 19:01:35Z peter $");
#include "libyasm-stdint.h"
#include "coretype.h"
@@ -336,55 +336,29 @@
* XXX: should rshift be an expr instead??
*/
- /* Check for not allowed cases on RHS */
- switch (e->terms[1].type) {
- case YASM_EXPR_REG:
- case YASM_EXPR_FLOAT:
- return 1; /* not legal */
- case YASM_EXPR_SYM:
- return 1;
- case YASM_EXPR_EXPR:
- if (value_finalize_scan(value, e->terms[1].data.expn,
- expr_precbc, 1))
- return 1;
- break;
- default:
- break;
- }
+ /* Check for single sym on LHS */
+ if (e->terms[0].type != YASM_EXPR_SYM)
+ break;
- /* Check for single sym and allowed cases on LHS */
- switch (e->terms[0].type) {
- /*case YASM_EXPR_REG: ????? should this be illegal ????? */
- case YASM_EXPR_FLOAT:
- return 1; /* not legal */
- case YASM_EXPR_SYM:
- if (value->rel || ssym_not_ok)
- return 1;
- value->rel = e->terms[0].data.sym;
- /* and replace with 0 */
- e->terms[0].type = YASM_EXPR_INT;
- e->terms[0].data.intn = yasm_intnum_create_uint(0);
- break;
- case YASM_EXPR_EXPR:
- /* recurse */
- if (value_finalize_scan(value, e->terms[0].data.expn,
- expr_precbc, ssym_not_ok))
- return 1;
- break;
- default:
- break; /* ignore */
- }
+ /* If we already have a sym, we can't take another one */
+ if (value->rel || ssym_not_ok)
+ return 1;
- /* Handle RHS */
- if (!value->rel)
- break; /* no handling needed */
+ /* RHS must be a positive integer */
if (e->terms[1].type != YASM_EXPR_INT)
return 1; /* can't shift sym by non-constant integer */
shamt = yasm_intnum_get_uint(e->terms[1].data.intn);
if ((shamt + value->rshift) > YASM_VALUE_RSHIFT_MAX)
return 1; /* total shift would be too large */
+
+ /* Update value */
value->rshift += shamt;
+ value->rel = e->terms[0].data.sym;
+ /* Replace symbol with 0 */
+ e->terms[0].type = YASM_EXPR_INT;
+ e->terms[0].data.intn = yasm_intnum_create_uint(0);
+
/* Just leave SHR in place */
break;
case YASM_EXPR_SEG:
« no previous file with comments | « third_party/yasm/patched-yasm/libyasm/tests/Makefile.inc ('k') | third_party/yasm/patched-yasm/m4/Makefile.inc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698